0
Why does it say .class expected
4 Antworten
+ 16
public class Program
{
public static void main(String[] args) {
Boolean b = true;
if (b) { System.out.println("Goodbye");
}
}
}
+ 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");
}
}
}
0
still not working