Anonymous classes are mostly used for event handling.
Which of these keywords cannot be used for a class which has been declared final?
public class operators {
public static void main(String[] args)
{
int a = 20, b = 10, c = 0, d = 20, e = 40, f = 30;
System.out.println((a%b * d - f));
}
}
Which access specifier can be used for a class so that its members can be accessed by a different class in the same package?
Which of the following is the correct definition of an immutable class in Java?
What is the correct outptut?
public class Abekus {
int x = 5;
public static void main(String[] args) {
Abekus a = new Abekus();
System.out.println(a.x+x);
}
}
The following code is an example of?
public classFirstClass {
public static voidmain(String[] args)
{
FirstClass f=new FirstClass();
System.out.println(“My First class”);
}
}
Which of the following is the correct way to implement a singleton class in Java?
Predict the output of the following Java code.
import java.util.*;
class Abekus {
public static void main(String args[]) {
Formatter F = new Formatter();
F.format("% d", 345);
System.out.println(F);
F.format("% d", -230);
System.out.println(F);
}
}
import java.util.*;
public class outputs
{
public static void main(String args[])
{
LinkedList list = new LinkedList();
list.add(new Integer(3));
list.add(new Integer(9));
list.add(new Integer(5));
list.add(new Integer(1));
list.addFirst(new Integer(6));
list.addLast(new Integer(9));
Iterator i = list.iterator();
Collections.sort(list);
System.out.print(list.peekFirst() + " "+ list.peekLast());
}
}