Logo

Java Questions Set 95:

Quiz Mode

The output of the relational operators is

1
2
3
4

Solution:

insertElement() method is used to insert value and its key  

1
2

Solution:

 

which one is provided thread safety

1
2
3
4

Solution:

When the local variable and instance variable are same then we used this variable

1
2

Solution:

int a =10;

long b=a;

the above code is an example of?

1
2
3
4

Solution:

What is the use of the final keyword in Java?

1
2
3
4

Solution:

The main difference between object-oriented languages and object-based languages is that:

1
2
3
4

Solution:

 class show 

    {

        public static void main(String args[]) 

        {

           try

           {

               int a = 9;

               int b = 5;

               int c = b / a;

               System.out.print("Abekus");

           }

           catch(Exception e) 

           {

               System.out.print("Slack");

           } 

           finally 

           {

               System.out.print("Java");

           } 

        }

    }

1
2
3
4
5

Solution:

Predict the output of the following Java code.

class Abekus {

public static void main(String args[])

{

try {

int i = 5 / 0;

}

catch (Exception e) {

System.out.print("Exception ");

}

catch (ArithmeticException e) {

System.out.print("ArithmeticException ");

}

System.out.println("i am on the last line.");

}

}

1
2
3
4

Solution:

// It is a class Abekus.

package com.pk3;

public class Abekus{

public void m1()

{

 System.out.println("method of Abekus has been called.");

}

}

// This is def class.

package com.pkg2;

import com.pk3.Abekus;

public class def extends Abekus {

 public static void main(String args[]) {

  Abekus A = new def();

  A.m1();

  System.out.println("This is Abekus.com");

}

}

What will be the correct output?

1
2
3
4

Solution: