What keyword is used to declare an interface in Java?
A variable declared as private x = 214;
can be accessed _____?
Which class has the ability to catch all exceptions that cannot be handled by Exception handling mechanisms.
Statement 1 - JAVA_HOME is used to set java path
Statement 2 - JAVA is used to set java path
Which of the following statements about JUnit is false?
What will be the output of the following Java code?
class IsinfiniteOutput
{
public static void main(String[] args)
{
Double d = new Double(1 / 0.0);
boolean x = d.isInfinite();
System.out.print(x);
}
}
What will be the output of the program?
public class Test
{
private static int[] x;
public static void main(String[] args)
{
System.out.println(x[0]);
}
}
Statement 1- previous() of ListIterator used to obtain an index of previous element
Statement 2- back() of ListIterator used to obtain an index of previous element
Statement 3- GoBack() of ListIterator used to obtain an index of previous element
Statement 4- previousIndex() of ListIterator used to obtain an index of previous element
Predict the output of the following Java code:
class Seller {
int value = 10000;
synchronized void cost(int value) {
System.out.println("Spend value");
if (this.value < value) {
System.out.println("Less value");
try {
wait();
} catch (Exception e) {}
}
this.value = this.value - value;
System.out.println("process completed");
}
synchronized void paid(int value) {
System.out.println("get value");
this.value = this.value + value;
System.out.println("completed");
notify();
}
}
public class Main {
public static void main(String args[]) {
Seller c = new Seller();
new Thread() {
public void run() {
c.cost(15000);
}
}.start();
new Thread() {
public void run() {
c.paid(10000);
}
}.start();
}
}