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); } }

18th Sep 2017, 8:38 PM
PrnceJack
PrnceJack - avatar
3 Respostas
+ 7
Change: "public static meyaw" To: "void meyaw" Remove: "return();"
18th Sep 2017, 8:42 PM
Rrestoring faith
Rrestoring faith - avatar
+ 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
18th Sep 2017, 8:43 PM
Joshua
Joshua - avatar
0
The : Public static meyaw is a static method and not a return type method so return isn't needed.
30th Sep 2017, 10:44 AM
Dosunmu Ayanda Yusuf
Dosunmu Ayanda Yusuf - avatar