Q1)
You need to create a class that will store a unique object elements. You do not need to sort these elements but they must be unique.
What interface might be most suitable to meet this need?
1)Set
2)List
3)Map
4)Vector
ans:1)
what not 3) Map to store unique object elements, and Map is unordered.
This question is from appliedreasoning
applet Q2)Do event adapter classes provide a default behaviour?
Q3)
<code>
public class Demo
{
public static void main(
String args[])
{
Demo d = new Demo();
call().run();
}
public static Demo call()
{
return null;
}
public static run()
{
System.out.println("Run");
}
}
</code>
output => Run
I though it causes a NullpointerException
Q4)
Overridding method cannot throw exception which is not thrown in overridden method.(True or false)
ans = true
Q5)
byte b;
double d =417.35;
b=(byte)d;
System.out.println(b);
output is 95
but how to convert a double value into byte type?