Logo

Java Questions Set 137:

Quiz Mode

 Enumeration is the interface of legacy is implemented by Hashtable and Dictionary classes 

1
2

Solution:

Which of the following statement will not increment the value by 1?

1
2
3
4
5

Solution:

Which interface abstracts the output of messages from the Apache HTTP Server (httpd)?

1
2
3
4

Solution:

Which of the following methods is a method of wrapper Integer for obtaining hash code for the invoking object?


1
2
3
4

Solution:

Which capability exists as a method in only one of the two classes when comparing java.io.BufferedWriter and java.io.FileWriter?

1
2
3
4

Solution:

class test{

public static void main (String[] args) {

   int x=10,y=15;

   if(~x!=10 || ~y<15)

   {

       x--;

   }

   else

   {

       y++;    

   }

   System.out.println(x+" "+(--y));

}

}

1
2
3
4

Solution:

What is the output of the following Java program?

1
2
3
4

Solution:

 Statement 1- Map class object uses the key to store value 

 Statement 2- Dictionaryclass object uses the key to store value 

 Statement 3- Hashtable class object uses the key to store value 

1
2
3
4
5

Solution:

Predict the output of the following Java code.

class Abekus implements Runnable {

public

void run()

{

System.out.println("Code Run");

}

} class AbekusMain {

public

static void main(String[] args)

{

Abekus o = new Abekus();

o.start();

System.out.println("Main code run");

}

}

1
2
3
4

Solution:

class human 

    {

        int i;

        double j;

    }

    class child extends human 

    {

int k;

    }

    class output 

    {

        public static void main(String args[]) 

        {

            human i = new human();

            child j = new child();

            Class ref;

            ref = j.getClass();

            System.out.print(ref.getSuperclass());

        }

    }

1
2
3
4
5

Solution: