In the following code suppose that f is an instance of Foo A
In the following code, suppose that f is an instance of Foo. Answer Question 2. class Foo {static int x; static int s; void imethod () {static void smethod {} Which of the following statements is incorrect? f.smethod(); System.out.println(Foo.s); Foo. imethod(); System.out.println(Foo.x);
Solution
Foo.imethod() is incorrect as a method can not be evoked without creating an instance of a class.
