Java OCA OCP Practice Question 1487

Question

Which of the following code fragments are valid method declarations?

Select 1 option

  • A. void m1{}
  • B. void m2(){ }
  • C. void m3(void) { }
  • D. m4 {}
  • E. m5(void) { }


Correct Option is  : B

Note

A valid method declaration MUST specify a return type, all other things are optional.




PreviousNext

Related