Q261
Open questionSelect an option to see the answer and solution.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
309
Questions
14/16
Page
Pick an option on a question to see the right answer and solution.
Q261
Open questionSelect an option to see the answer and solution.
Q262
Open questionclass Output
{
public static void main(String args[])
{
char a[] = {'a', '5', 'A', ' '};
System.out.print(Character.isDigit(a[0])+ " ");
System.out.print(Character.isWhitespace(a[3])+ " ");
System.out.print(Character.isUpperCase(a[2]));
}
}Select an option to see the answer and solution.
Q263
Open questionSelect an option to see the answer and solution.
Q264
Open questionSelect an option to see the answer and solution.
Q265
Open questionSelect an option to see the answer and solution.
Q266
Open questionpublic class BoxDemo
{
public static <U> void addBox(U u,
java.util.List<Box<U>> boxes)
{
Box<U> box = new Box<>();
box.set(u);
boxes.add(box);
}
public static <U> void outputBoxes(java.util.List<Box<U>> boxes)
{
int counter = 0;
for (Box<U> box: boxes)
{
U boxContents = box.get();
System.out.println("Box #" + counter + " contains [" + boxContents.toString() + "]");
counter++;
}
}
public static void main(String[] args)
{
java.util.ArrayList<Box<Integer>> listOfIntegerBoxes = new java.util.ArrayList<>();
BoxDemo.<Integer>addBox(Integer.valueOf(10), listOfIntegerBoxes);
BoxDemo.outputBoxes(listOfIntegerBoxes);
}
}Select an option to see the answer and solution.
Q267
Open questionclass X
{
int a;
double b;
}
class Y extends X
{
int c;
}
class Output
{
public static void main(String args[])
{
X a = new X();
Y b = new Y();
Class obj;
obj = b.getClass();
System.out.print(obj.getSuperclass());
}
}Select an option to see the answer and solution.
Q268
Open questionSelect an option to see the answer and solution.
Q269
Open questionSelect an option to see the answer and solution.
Q270
Open questionint a = random.nextInt(15) + 1;Select an option to see the answer and solution.
Q271
Open questionSelect an option to see the answer and solution.
Q272
Open questionSelect an option to see the answer and solution.
Q273
Open questionSelect an option to see the answer and solution.
Q274
Open questionimport java.lang.reflect.*;
class Additional_packages
{
public static void main(String args[])
{
try
{
Class c = Class.forName("java.awt.Dimension");
Method methods[] = c.getMethods();
for (int i = 0; i < methods.length; i++)
System.out.println(methods[i]);
}
catch (Exception e)
{
System.out.print("Exception");
}
}
}Select an option to see the answer and solution.
Q275
Open questionSelect an option to see the answer and solution.
Q276
Open questionSelect an option to see the answer and solution.
Q277
Open questionclass Output
{
public static void main(String args[])
{
int a = Character.MAX_VALUE;
System.out.print((char)a);
}
}Select an option to see the answer and solution.
Q278
Open questionSelect an option to see the answer and solution.
Q279
Open questionSelect an option to see the answer and solution.
Q280
Open questionclass newthread implements Runnable
{
Thread t1,t2;
newthread()
{
t1 = new Thread(this,"Thread_1");
t2 = new Thread(this,"Thread_2");
t1.start();
t2.start();
}
public void run()
{
t2.setPriority(Thread.MAX_PRIORITY);
System.out.print(t1.equals(t2));
}
}
class multithreaded_programing
{
public static void main(String args[])
{
new newthread();
}
}Select an option to see the answer and solution.