Logo

Java Questions Set 224:

Quiz Mode

Which Java class can encapsulate an entire executing program?

1
2
3
4

Solution:

Which class is the super class of the wrapper classes Double and Float?

1
2
3
4

Solution:

Can we declare a class as abstract without having any abstract methods?

1
2
3
4

Solution:

class test{

public static void main (String[] args) {

       int a,b,c,d;

            a=b=c=d=40;

            a*=b/=c-=d+=5;

           System.out.println(a+" "+b+" "+c+" "+d);

}

}

1
2
3
4

Solution:

The error in the following code is :

byte b ;

b = 50 ;

b = b * 50 ;

1
2
3
4

Solution:

What does the following code prints:

public class Test{

    public static void main(String args[]){

        int a=12,b=13,c=14;

        switch(a){

            case 14:

                System.out.println(b);

            default:

                System.out.println(c);

        }

    }

}

Solution:

Statement 1-  dequeue() and peek() remove and return the next time in line 

Statement 2-  dequeue() and peek() return the next item in line 

Statement 3-  peek() removes and returns the next item in line while dequeue() returns the next item in line 

1
2
3
4

Solution:

Predict the output of the following Java code:

import java.util.Scanner;

public class Main

{

    public static void main(String args[])

    {

        String s1 = "Abekus";

        String s2 = new String("Abekus");

        System.out.print(s1 == s2);

        System.out.println(s1 == s2.intern());

    }

}

1
2
3
4

Solution:

When does Overloading not occur?

1
2
3
4

Solution: