Can anyone tell me what is wrong with this Java code😛 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

30th Mar 2020, 9:33 AM
Atoms~⚛
Atoms~⚛ - avatar
3 Answers
+ 2
https://code.sololearn.com/cCDZ3g4NDt04/?ref=app
30th Mar 2020, 9:49 AM
Muhammad Galhoum
Muhammad Galhoum - avatar
+ 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/
30th Mar 2020, 9:39 AM
Jayakrishna 🇮🇳
0
Scanner myScan = new Scanner(System.in); int no_of_criminals=myScan.nextInt();
30th Mar 2020, 1:27 PM
remya ramakrishnan
remya ramakrishnan - avatar