fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. }
  14. }
  15.  
  16. import java.util.Scanner;
  17.  
  18. public class Rectangle1
  19. {
  20. public static void main(String[] args)
  21. {
  22. Scanner keyboard = new Scanner(System.in);
  23.  
  24. // Input the width of the rectangle
  25. System.out.print("Enter width > 0: ");
  26. int width = keyboard.nextInt();
  27.  
  28. // Input the height of the rectangle
  29. System.out.print("Enter height > 0: ");
  30. int height = keyboard.nextInt();
  31.  
  32. // Output height rows of width columns of '+'s
  33. int row = 0;
  34. while (row < height)
  35. {
  36. // Output one row of width '+'s
  37. int column = 0;
  38. while (column < width)
  39. {
  40. System.out.print('+');
  41. column = column + 1; // go to the next column
  42. }
  43. System.out.println(); // terminate the row
  44.  
  45. row = row + 1; // go to the next row
  46. }
  47. }
  48. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:16: error: class, interface, or enum expected
import java.util.Scanner;
^
1 error
stdout
Standard output is empty