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 abstract final volatile static native abstract final volatile static ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control Determine output:public class InitDemo{static int i = demo();static{ System.out.print(i); }InitDemo(){System.out.print("hello1");}public static void main(String... args){ System.out.print("Hello2");} static int demo(){ System.out.print("InsideDemo");return 10;}} InsideDemo 10 Hello2 hello1 IllegalArgumentException is thrown at runtime. Hello2 InsideDemo 10 Compilation error. InsideDemo 10 Hello2 InsideDemo 10 Hello2 hello1 IllegalArgumentException is thrown at runtime. Hello2 InsideDemo 10 Compilation error. InsideDemo 10 Hello2 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); }} Compile time error. one two 0 None of these one two 10 one two 1 Compile time error. one two 0 None of these one two 10 one two 1 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);}} 6 0 Compile with error Runtime Exception 5 6 0 Compile with error Runtime Exception 5 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. None of these Any class in com.mypackage package. Only the Test class. Any class that extends Test. Any class. None of these Any class in com.mypackage package. Only the Test class. Any class that extends Test. ANSWER DOWNLOAD EXAMIANS APP
Declaration and Access Control What is the output for the below code ?public class A{ static{ System.out.println("static"); } { System.out.println("block"); } public A(){ System.out.println("A"); } public static void main(String[] args){ A a = new A(); }} None of these A block static static block A static A A None of these A block static static block A static A A ANSWER DOWNLOAD EXAMIANS APP