(Solved):Which of the following statements is incorrect? a) System.out.println(f.s); b) System.out.println (f.i); c) f.smethod(); d) None of the above View Answer…

 

Question

Which of the following statements is incorrect?

a) System.out.println(f.s);

b) System.out.println (f.i);

c) f.smethod();

d) None of the above

 

EXPERT ANSWER

Let considering one example as given below:

public class First

{

static String s;

int i;

public:

static void smethod()

{

}

}

In the main method, create an object of an above class with name ‘f’.

a) System.out.println(f.s);

b) System.out.println (f.i);

c) f.smethod();

In the first and second statement, the member variable of the class is passed as an argument to the println() function and it is

Scroll to top