0
Could anyone get this to work...? I kinda have a habit of messing up good code :-)
public class Animal { void bark() { System.out.println("Woof-Woof"); } public static meyaw(int x) { if (x==1){ System.out.println("Meyaw from KAPAW!"); } else { System.out.println("Its a cat"); } return (); } } class MyClass { public static void main(String[ ] args) { Animal dog = new Animal(); dog.bark(); Animal cat = new Animal (); cat.meyaw (1); } }
3 Respuestas
+ 7
Change:
"public static meyaw"
To:
"void meyaw"
Remove:
"return();"
+ 5
in your meyaw method you forgot to specify what you were returning
it should look like this:
public static void meyaw() {
}
and take away the return, it is not needed
0
The :
Public static meyaw is a static method and not a return type method so return isn't needed.