Java class variable error?
2 answers
Because it Whale
is a method and you cannot define a static field inside a method. You can have a local one number4
like
public static void Whale() {
int number4 = 86;
or a static
, for example
static int number4 = 86;
public static void Whale() {
Finally, the class names of the conventions must begin with an uppercase letter ( CamelCase
) and method names with a lowercase letter ( CamelCase
).
+5
source to share