31. Which of these is a wrapper for simple data type float?
32. What will be the output of the following Java code?
class Output
{
public static void main(String args[])
{
Double i = new Double(257.578);
int x = i.intValue();
System.out.print(x);
}
}
class Output
{
public static void main(String args[])
{
Double i = new Double(257.578);
int x = i.intValue();
System.out.print(x);
}
}
33. What will be the output of the following Java code?
class A
{
int x;
int y;
void display()
{
System.out.print(x + " " + y);
}
}
class Output
{
public static void main(String args[])
{
A obj1 = new A();
A obj2 = new A();
obj1.x = 1;
obj1.y = 2;
obj2 = obj1.clone();
obj1.display();
obj2.display();
}
}
class A
{
int x;
int y;
void display()
{
System.out.print(x + " " + y);
}
}
class Output
{
public static void main(String args[])
{
A obj1 = new A();
A obj2 = new A();
obj1.x = 1;
obj1.y = 2;
obj2 = obj1.clone();
obj1.display();
obj2.display();
}
}
34. What will be the output of the following Java code?
class Output
{
public static void main(String args[])
{
double x = 3.14;
int y = (int) Math.abs(x);
System.out.print(y);
}
}
class Output
{
public static void main(String args[])
{
double x = 3.14;
int y = (int) Math.abs(x);
System.out.print(y);
}
}
35. Which of these methods of Byte wrapper can be used to obtain Byte object from a string?
36. What will be the output of the following Java program?
class newthread implements Runnable
{
Thread t;
newthread()
{
t = new Thread(this,"New Thread");
t.start();
}
public void run()
{
t.setPriority(Thread.MAX_PRIORITY);
System.out.println(t);
}
}
class multithreaded_programing
{
public static void main(String args[])
{
new newthread();
}
}
class newthread implements Runnable
{
Thread t;
newthread()
{
t = new Thread(this,"New Thread");
t.start();
}
public void run()
{
t.setPriority(Thread.MAX_PRIORITY);
System.out.println(t);
}
}
class multithreaded_programing
{
public static void main(String args[])
{
new newthread();
}
}
37. Which of these method returns a smallest whole number greater than or equal to variable X?
38. What will be the output of the following Java code?
class Output
{
public static void main(String args[])
{
double x = 3.14;
int y = (int) Math.ceil(x);
System.out.print(y);
}
}
class Output
{
public static void main(String args[])
{
double x = 3.14;
int y = (int) Math.ceil(x);
System.out.print(y);
}
}
39. Which of this package is used for handling security related issues in a program?
40. What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
Long i = new Long(256);
System.out.print(i.hashCode());
}
}
class Output
{
public static void main(String args[])
{
Long i = new Long(256);
System.out.print(i.hashCode());
}
}
Read More Section(Interfaces and Abstract Classes)
Each Section contains maximum 100 MCQs question on Interfaces and Abstract Classes. To get more questions visit other sections.