• Register
0 votes

Problem :

I am just a beginner in java coding.

Recently i got this error and was unable to solve it. Please help me with this.

exception in thread "main" java.lang.illegalstateexception: scanner closed

by (6.9k points)  

1 Answer

0 votes

Solution : 

To resolve the issue one must close the scanner and then

call nextInt on it 

calc c = new calc();

int a,b; 

System.out.print("Enter the first number:"); 


and your code will work

by (36.1k points)  
edited by