Logo

Java Questions Set 126:

Quiz Mode

How many methods does the Serializable interface have?

1
2
3
4

Solution:

The third type of comment for automatic generation of documentation is used by

1
2
3
4

Solution:

Which access modifier is used to access a member of a class before an object of that class is created?

1
2
3
4

Solution:

class test{

public static void main (String[] args) {

  int x=1,y=16;

  x=x>>2;

  y=y>>x;

  System.out.println(~x<<2);

}

}

1
2
3
4

Solution:

public class check{

public static void main(String args[]){

StringBuilder sb= new StringBuilder("java is simple");

System.out.println(sb.length());

}

}

1
2
3
4

Solution:

class Main {

 public static void main(String args[]){

    final int a;

    a = 20;

    a = 30;

    System.out.println(a);

 }

}

1
2
3
4

Solution:

What is the output of the following program?

class output 

    {

        public static void main(String args[])

        {

           String s1 = "Hello World";

           String s2 = s1.substring(0 , 3);

           System.out.println(s2);

        }

   }

1
2
3
4

Solution:

public class output 

    {

         public static void main(String args[]) 

        {

            double a = 4.5;  

            double b = 5.5;

            double c = Math.max( a, b );

            System.out.print(c);

        }

    }

1
2
3
4

Solution:

What will be the output of the following Java program?


import java.lang.System;

class Output

{

public static void main(String args[])

{

byte a[] = { 65, 66, 67, 68, 69, 70 };

byte b[] = { 71, 72, 73, 74, 75, 76 };

System.arraycopy(a, 0, b, 3, a.length - 3);

System.out.print(new String(a) + " " + new String(b));

}

1
2
3
4

Solution:

What will be the output of the following Java program?


    class newthread implements Runnable 

    {

Thread t;

        newthread() 

        {

            t = new Thread(this,"My Thread");

            t.start();

}

    }

    class multithreaded_programing 

    {

        public static void main(String args[]) 

        {

            new newthread();        

        }

    }


1
2
3
4

Solution: