Why does it say .class expected | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
17th Jul 2017, 8:23 PM
Whitehat
Whitehat - avatar
3 Answers
+ 16
public class Program { public static void main(String[] args) { Boolean b = true; if (b) { System.out.println("Goodbye"); } } }
17th Jul 2017, 8:26 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 1
This is your current code (with my added comments): public static void main(String[] args) { // Although Boolean is valid as the class wrapper for of the primitive boolean type // you can and should use boolean instead also A should be lowercase Boolean A = true; { // Remove the opening curly brace '{' // You are creating and assigning another boolean variable in your if statement. // Change Boolean A = true to A and remove the semicolon after true); if (Boolean A = true); { System.out.println("Goodbye"); } } // Remove this closing curly brace '}' too } So your code should look exactly like ValentineHacker posted or: public class Program { public static void main(String[] args) { boolean a = true; if (a) { System.out.println("Goodbye"); } } }
17th Jul 2017, 9:07 PM
ChaoticDawg
ChaoticDawg - avatar
0
still not working
17th Jul 2017, 8:29 PM
Whitehat
Whitehat - avatar