fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.Scanner;
  4.  
  5.  
  6. /* Name of the class has to be "Main" only if the class is public. */
  7. class Ideone
  8. {
  9. public static void main (String[] args) throws java.lang.Exception
  10. {
  11. // your code goes here
  12. Scanner sc = new Scanner (System.in);
  13. System.out.print("Enter the lentgh of side : ");
  14. int x = sc.nextInt();
  15. System.out.println("The Area of Square = " + (x*x));
  16. }
  17. }
Runtime error #stdin #stdout #stderr 0.12s 49204KB
stdin
stdout
Enter the lentgh of side : 
stderr
Exception in thread "main" java.util.NoSuchElementException
	at java.base/java.util.Scanner.throwFor(Scanner.java:937)
	at java.base/java.util.Scanner.next(Scanner.java:1594)
	at java.base/java.util.Scanner.nextInt(Scanner.java:2258)
	at java.base/java.util.Scanner.nextInt(Scanner.java:2212)
	at Ideone.main(Main.java:14)