Logo

Java Questions Set 82:

Quiz Mode

 Java is platform-dependent 

1
2

Solution:

The navigable map is a 

1
2
3
4

Solution:

 Jvm finds the .class files without uncompressing this JAR.

1
2

Solution:

Which class is used to create user-defined exceptions?

1
2
3
4

Solution:

Which of these packages contains the exception Stack Overflow in Java?

1
2
3
4

Solution:

public class output{

public static void main(String args[]){

int a=100;

int b=120;

int result=0;

result= (a + ++b)+1+a++;

System.out.println(result);

 }

}

1
2
3
4

Solution:

Predict the output of the following Java code.

class Abekus { 

public static void main(String[] args) 

char ch[][] = { { 'a', 'b', 'd' }, { 'c', 'e', 'f', 'g' } }; 

for (int i = 0; i < 2; i++) { 

for (int j = 0; j < ch[i].length; j++) 

System.out.print(ch[i][j] + " "); 

}

1
2
3
4

Solution:

Predict the output of the following Java code.

import java.util.*;

public class Abekus {

public static void main(String[] args) {

Formatter F = new Formatter();

F.format("%(d", 345);

System.out.println(F);

F = new Formatter();

F.format("%(d", -230);

System.out.println(F);

}

}

1
2
3
4

Solution:

What will be the output of the following Java code?


class NewThread extends Thread

{

NewThread()

{

super("My Thread");

start();

}

public void run()

{

System.out.println(this);

}

}

class MultithreadedProgramming

{

public static void main(String[] args)

{

new NewThread();

}

}

1
2
3
4

Solution:

Predict the output of the following Java code:

public class Abekus {

public static void main(String[] args) {

Complex c1 = new Complex();

Complex c2 = new Complex(c1);

System.out.println(c2);

}

}

class Complex {

private double r, i;

public String toString() {

return "(" + r + " + " + i + "i)";

}

Complex(Complex c) {

r = c.r;

i = c.i;

}

}

1
2
3
4

Solution: