Logo

Java Questions Set 47:

Quiz Mode

What is the output of the following code?

1
2
3
4

Solution:

When implementing an interface method in Java, the method must be declared as:

1
2
3
4

Solution:

Which of these methods of the String class is used to extract multiple characters at a time from a String object?

1
2
3
4

Solution:

From where does the break statement cause an exit?

1
2
3
4

Solution:

public class Demo123{

     public static void main(String args[]){

  int i;

  for( i=1;i<6;i++){

    if(i<4)

  continue;

  }

     System.out.println(i);   

}

}

1
2
3
4

Solution:

class test {

public static void main (String[] args) {

  int[][] arr=new int[][]{{0,1,2,3,4,5,6,7,8,9},{10,11,12,13,14,15,16}};

       int n=2;

       System.out.println((double)(arr[--n][n*5])/10*2+3/10);

}

}

1
2
3
4

Solution:

What will be the output of the following code?

    class main

    {

        public static void main(String args[])

        {

             Object obj = new Object();

    System.out.print(obj.getclass());

        }

    }


1
2
3
4

Solution:

public class outputs 

    {

        public static void main(String args[]) 

        {

          

             double a = 6.4;

             int  b = 15;

             a = a % 25;

             b = b % 32;

             System.out.println(a%45+b%5 +10);

 

        } 

    }

1
2
3
4

Solution:

class GFG {

public static void main (String[] args) {

     int[] A=new int[2];

     int[] B=new int[5];

     A=B;

     System.out.println(A[4]);

     System.out.print(B[0]);

}

}

1
2
3
4

Solution: