D Deepak Sahoo • 10.78K Points Tutor II Bookmark Embed Report View In MB-Short 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: 123 Filed under category JAVA Share
Discusssion
Login to discuss.