public class IfClass { public static void main(String[] args) { int noOfPetals = 5; if (noOfPetals % 2 == | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

public class IfClass { public static void main(String[] args) { int noOfPetals = 5; if (noOfPetals % 2 ==

Eror shows me in } else {. Please solve it

24th Jul 2020, 4:54 AM
Gautam Patel
Gautam Patel - avatar
4 Answers
+ 5
https://code.sololearn.com/cB4HSoKru7QZ/?ref=app Remove the semicolon after if (condition)
24th Jul 2020, 5:04 AM
Nilesh
+ 10
//remove ; after if (condition) if(noOfPetals % 2 == 0){
24th Jul 2020, 5:03 AM
᮴Ridwan_
᮴Ridwan_ - avatar
+ 5
Pls reframe you Question once . Your code is totally incomplete Or paste it in the comment box or code playground
24th Jul 2020, 5:00 AM
Nilesh
+ 1
public class IfClass { public static void main(String[] args) { int noOfPetals = 5; if (noOfPetals % 2 == 0); { System.out.println("she loves me"); } else { System.out.println("she loved me not"); } } }
24th Jul 2020, 5:01 AM
Gautam Patel
Gautam Patel - avatar