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);}} 0 Compile with error Runtime Exception 6 5 0 Compile with error Runtime Exception 6 5 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(); }} BaseDerived Compilation Error Exception is thrown at runtime Derived BaseDerived Compilation Error Exception is thrown at runtime Derived ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control What can directly access and change the value of the variable qusNo?package com.mypackage;public class Test{ private int qusNo = 100;} Any class that extends Test. Only the Test class. Any class in com.mypackage package. Any class. None of these Any class that extends Test. Only the Test class. Any class in com.mypackage package. Any class. None of these ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control A package is a collection of Classes Editing tools Classes and Interfaces Interfaces Editing tools and Interfaces Classes Editing tools Classes and Interfaces Interfaces Editing tools and Interfaces ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control The object is created with new keyword Depends on the code At Compile-time None of these At run-time Depends on the code At Compile-time None of these At run-time 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 two one 20 one 20 one two 20 one two one 20 ANSWER DOWNLOAD EXAMIANS APP