+ 4
Can anyone tell me what is wrong with this Java codeđ
I don't understand why this code is not working it always ends up being error and please add a user input(scanner)for var no of villians.it would be a great help https://code.sololearn.com/cmgr0VgYtUXQ/?ref=app
3 RĂ©ponses
+ 2
https://code.sololearn.com/cCDZ3g4NDt04/?ref=app
+ 1
After if condition, there is semicolon in line 7.
It should be removed...
Line 7:
} else if( no_of_criminals<=10);{
Correct :
} else if( no_of_criminals<=10){
Edit:
For input taking,
import java.util.Scanner;
See this.......
https://www.sololearn.com/learn/Java/2220/
0
Scanner myScan = new Scanner(System.in);
int no_of_criminals=myScan.nextInt();