• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes
7 views

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:"); 

a=s.nextInt();

and your code will work

by (21.9k points)  
edited by
...