Java OCA OCP Practice Question 826

Question

How can you declare a method m() such that an instance of the class is not needed to access it and all the members of the same package have access to it.

Select 3 options

  • A. public static void m ()
  • B. static void m ()
  • C. protected static void m ()
  • D. void m ()
  • E. protected void m ()
  • F. public abstract static void m ()


Correct Options are  : A B C

Note

The method has to be static.

As the question does not say that other packages should not have access to the method so public or protected is also correct.




PreviousNext

Related