0
Help me with program.
It doesn't works... https://code.sololearn.com/c1T3UYI66B3g/?ref=app
3 Answers
+ 1
Put brackets (aka {}) around the FindingRats method.
Also, try to keep the java convention and write methods with camelCase. For this, it should be "findingRats()"
Finally, you don't need to make the methods static if you call them on objects (like black.Voice();). If you make them static, you can call them just with Cat.Voice(), Cat.FindingRats(Name2) and it would do the same thing, but it is not recommended.
Happy coding.
+ 4
CHANGE:
static void FindingRats(String a);
System.out.println("Finding rats.");
System.out.println("Finding rats..");
System.out.println("Finding rats...");
System.out.println("Rats was found by "+a);
TO:
static void FindingRats(String a){
System.out.println("Finding rats.");
System.out.println("Finding rats..");
System.out.println("Finding rats...");
System.out.println("Rats was found by "+a);
}
+ 1
Thank you!