Declaration and Access Control Choose the correct statement. Restriction on static methods are: I. They can only call other static methods.II. They must only access static data.III. They cannot refer this or super in any way. Only (III) (II) and (III) Only (I) (I), (II) and (III) (I) and (II) Only (III) (II) and (III) Only (I) (I), (II) and (III) (I) and (II) ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control Determine Output:class MyClass{ static final int a = 20; static final void call(){ System.out.println("two"); } static{ System.out.println("one"); }}public class Test{ public static void main(String args[]){ System.out.println(MyClass.a); }} one 20 one two 20 one 20 one two one 20 one two 20 one 20 one two ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control A package is a collection of Editing tools Classes Classes and Interfaces Editing tools and Interfaces Interfaces Editing tools Classes Classes and Interfaces Editing tools and Interfaces Interfaces ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control Name the keyword that makes a variable belong to a class, rather than being defined for each instance of the class. native static abstract volatile final native static abstract volatile final ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control What will be the output after the following program is compiled and executed?public class Test{ public static void main(String args[]){ int x = 10; x = myMethod(x--); System.out.print(x); } static int myMethod(final int x){ return x--; }} None of these The will compile successfully and display 9 as output. The program will lead to compilation error. The program will compile successfully and display 10 as output. The program will lead to runtime error. None of these The will compile successfully and display 9 as output. The program will lead to compilation error. The program will compile successfully and display 10 as output. The program will lead to runtime error. ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control What will be the output after compiling and running following program code?public class Test{ static int a; public static void main(String[] args){ System.out.println("one"); call(1); } static void call(int a){ this.a=10; System.out.println("two "+a); }} one two 10 Compile time error. one two 1 one two 0 None of these one two 10 Compile time error. one two 1 one two 0 None of these ANSWER DOWNLOAD EXAMIANS APP