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.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. int a = 0;
  14. int b = 0;
  15. int answer = 0;
  16.  
  17. Scanner iscan = new Scanner (System.in);
  18.  
  19. System.out.println("Enter the first number");
  20.  
  21. int a = iscan.nextline();
  22.  
  23. System.out.println("Enter your secnond number");
  24.  
  25. int b = iscan.nextline();
  26.  
  27. answer = a + b;
  28.  
  29. System.out.println("The answer is " + answer);
  30.  
  31.  
  32.  
  33. }
  34. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:21: error: variable a is already defined in method main(String[])
		int a = iscan.nextline();
		    ^
Main.java:21: error: cannot find symbol
		int a = iscan.nextline();
		             ^
  symbol:   method nextline()
  location: variable iscan of type Scanner
Main.java:25: error: variable b is already defined in method main(String[])
		int b = iscan.nextline();
		    ^
Main.java:25: error: cannot find symbol
		int b = iscan.nextline();
		             ^
  symbol:   method nextline()
  location: variable iscan of type Scanner
4 errors
stdout
Standard output is empty