Java Test
Java Test
1. 2variable 2. #myvar
3. +@$var 4. $_myvar
1. default 2. null
3. String 4. volatile
System.out.println(arr[1]);
1. arr.length() 2. arr[].length()
3. arr[].length 4. arr.length
int j = 5;
if ( i < j-- )
1. 0 3 2 2. 1 2 3
3. 0 3 4 4. 1 4 2
A9. Which declaration of the main() method is valid ?
1. public void main( String args [] ) 2. public void static main( String args [] )
3. final public static void main(String []arr) 4. public static void main( String []arr)
A10. Which one of the following is invalid declarations of a char ?
1. char c1 = 064770; 2. char c2 = 'face';
3. char c3 = 0xbeef; 4. char c6 = '\uface';
A11. What will be the output of the following code ?
public static void main(String[] args)
double d = 100.04;
float f = d;
1. 100.04 2. 100.0
3. compilation error 4. 100
class Super {}
Super x;
Sub y;
B b = new C();
A a = b;
if (a instanceof A) System.out.println("A");
if (a instanceof B) System.out.println("B");
if (a instanceof C) System.out.println("C");
if (a instanceof D) System.out.println("D");
class A {}
class B extends A {}
class C extends B {}
class D extends C {}
System.out.println(an.name+" "+an.makeNoise());
System.out.println(argv[1])
1. myprog 2. good
3. morning 4. everyone
public class A
int x = 10;
package pck2;
import pck1.*;
class Test
System.out.println(a.x); // line 8
System.out.println(a.y); // line 9
interface A {}
class B {}
class D implements A {}
// Declaration statements :
B b = new B();
C c = new C();
D d = new D();
1. c = d; 2. d = c;
3. A a = d; 4. d = (D)c;