Logo

Java Questions Set 129:

Quiz Mode

Which of these interfaces is not part of Java's collection framework?

1
2
3
4

Solution:

What is the output of the following Java program?

1
2
3
4

Solution:

get() methods are used to retrieve the elements in properties object at a specific location  

1
2

Solution:

An array elements are always stored in

1
2
3

Solution:

What are the benefits of using inheritance in Java?

1
2
3
4
5
6

Solution:

Which class in the java.lang package does not override the equals() and hashCode() methods, inheriting them directly from class Object?

1
2
3
4

Solution:

Which statement is true about Java?

1
2
3
4

Solution:

class test{

public static void main (String[] args) {

   String str="My name is Joker";

   if(str.charAt(9)==(int)str.charAt(9))

   {

       System.out.println(Integer.toBinaryString(32/2/2));

   }

   else

   {

       System.out.println(Double.parseDouble("100"));    

   }

}

}

1
2
3
4

Solution:

Which of the following code snippets is equivalent to the given Java code?

public class ex {

  public static void main(String[] args) {

int x=10,y=20;

if(x>5){

if (y>10)

System.out.println("Hello");

  }

else

System.out.println("World");

}

}

1
2
3
4

Solution:

class Father{

void run(){

System.out.println("father start running");

}

void walk(){

System.out.println("father start walking");

  }

}

class Child extends Father{

@Override

void run(){

System.out.println("children start running");

}


@Override

void walk(){

System.out.println("children start walking");

}

void sleep(){

System.out.println("children start sleep");

  }

}

public class main {

public static void main(String args[]){

Father f1=new Father();

Child c1= new Child();

c1.run();

c1.walk();

  }

}

1
2
3
4

Solution: