Declaration and Access Control The object is created with new keyword At Compile-time At run-time Depends on the code None of these At Compile-time At run-time Depends on the code None of these ANSWER DOWNLOAD EXAMIANS APP
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. (I), (II) and (III) (I) and (II) Only (III) (II) and (III) Only (I) (I), (II) and (III) (I) and (II) Only (III) (II) and (III) Only (I) ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control What is the result of compiling and running the following code?class Base{ private Base(){ System.out.print("Base"); }}public class test extends Base{ public test(){ System.out.print("Derived"); } public static void main(String[] args){ new test(); }} Derived Compilation Error Exception is thrown at runtime BaseDerived Derived Compilation Error Exception is thrown at runtime BaseDerived ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control Choose the correct statementpublic class Circle{ private double radius; public Circle(double radius){ radius = radius; }} The program has a compilation error because it does not have a main method. The program has a compilation error because we cannot assign radius to radius. The program will compile, but we cannot create an object of Circle with a specified radius. The object will always have radius 0. The program does not compile because Circle does not have a default constructor. The program has a compilation error because it does not have a main method. The program has a compilation error because we cannot assign radius to radius. The program will compile, but we cannot create an object of Circle with a specified radius. The object will always have radius 0. The program does not compile because Circle does not have a default constructor. ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control What will be the output?public class Test{static{int a = 5;}public static void main(String args[]){new Test().call();}void call(){this.a++;System.out.print(this.a);}} Compile with error 6 Runtime Exception 5 0 Compile with error 6 Runtime Exception 5 0 ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control What will be the output for the below code?static public class Test{ public static void main(String[] args){ char c = 'a'; switch(c){ case 65 : System.out.println("one");break; case 'a': System.out.println("two");break; case 3 : System.out.println("three"); } }} None of these two Compile error - char can't be permitted in switch statement. one Compile error - Illegal modifier for the class Test; only public, abstract & final are permitted. None of these two Compile error - char can't be permitted in switch statement. one Compile error - Illegal modifier for the class Test; only public, abstract & final are permitted. ANSWER DOWNLOAD EXAMIANS APP