0

What's wrong with this code, I ran it , it has no output

public class Animal { void bark() { System.out.println("Woof-Woof"); } }

16th Nov 2019, 5:19 AM
Abiodun-oyekan Oyetayo Emmanuel
Abiodun-oyekan Oyetayo Emmanuel - avatar
2 Respostas
+ 5
Where is your main method? Try something like this. public class Program { public static void bark(){ System.out.println("woof-woof"); } public static void main(String[] args) { bark(); } }
16th Nov 2019, 5:22 AM
Avinesh
Avinesh - avatar
0
Hey.. others are confused. Write the main method or make connection with a class file which has a main method
17th Nov 2019, 6:30 AM
Rusira Vindiya
Rusira Vindiya - avatar