Yeah, because you are writing code, but it is not inside of any particular method. If you look at where your brackets are located, you will see that those print statements are inside of the class. . but not inside of any method. Put those System.out.printlns and all of the other code that you threw into the class into main or into some other method. For example,
public class BestJewSinceJCExample{
System.out.println("Print me");
public static void main(String[] args){
int a = 0;
System.out.println("a's value is " + a);
}
}
The code above makes no sense because the main method is executed when the program is run. At what point is the print statement that says "print me" supposed to happen? If you wanted "print me" to be the first thing the program says, then you would have to do the following:
public class BestJewSinceJCExample{
public static void main(String[] args){
System.out.println("Print me");
int a = 0;
System.out.println("a's value is " + a);
}
}
Along the same lines, you cannot have random statements and loops (while, for, etc) in the class body. You should only be declaring variables and initializing them in the class body. Anyway, I don't mind helping, but if you are a beginner to Java, you should read some of the tutorials stickied at the top of this forum.