A Admin • 828.03K Points Coach Q. Which of the following is the correct syntax for declaring a method in Java? (A) void myMethod() { System.out.println(“Hello”); } (B) public void myMethod() { System.out.println(“Hello”); } (C) myMethod() { System.out.println(“Hello”); } (D) public myMethod() { System.out.println(“Hello”); } Correct Answer - Option(B) Views: 11 Filed under category Java Hashtags: Share Manage Tags
Discusssion
Login to discuss.