Read this piece of code carefully
if("String".toString() == "String")System.out.println("Equal");elseSystem.out.println("Not Equal");
Answers
Read this piece of code
carefully
if(" String ".trim() == "String")System.out.println("Equal");elseSystem.out.println("Not Equal");
Answers
Read the code below. Will be the result of attempting to compile and run the
code below.
public class AQuestionAnswers
{
public void method(Object o)
{
System.out.println("Object Verion");
}public void method(String s)
{
System.out.println("String Version");
}public static void main(String args[])}
{
AQuestion question = new AQuestion();
question.method(null);
}
Read the code below. Will be the result of attempting to compile and run the
code below.
public class AQuestionAnswers
{
public void method(StringBuffer sb)
{
System.out.println("StringBuffer Verion");
}public void method(String s)
{
System.out.println("String Version");
}public static void main(String args[])}
{
AQuestion question = new AQuestion();
question.method(null);
}
Read the following code below.
A Class implementing this interface should
An Interface can never be private or protected.
Answers
True
False
A Vector class in jdk 1.2
A String Class
The class which implements AQuestion
public class AQuestion
{private int i = j;}
private int j = 10;
public static void main(String args[])
{
System.out.println((new AQuestion()).i);
}
public class AQuestion
{
private int i =
giveMeJ();
private
int j = 10;
private int
giveMeJ()
{
return j;
}
public static void
main(String args[])
{
System.out.println((new AQuestion()).i);
}
}
Answers
public class AQuestion
{
public static
void main(String args[])
{
System.out.println("Before Try");
try
{
}
catch(Throwable t)
{
System.out.println("Inside Catch");
}
System.out.println("At the End");
}
}
public class AQuestion
{
public static void main(String args[])
{
System.out.println("Before Try");
try
{
}
catch(java.io.IOException t)
{
System.out.println("Inside Catch");
}
System.out.println("At the End");
}
}
The class java.lang.Exception
i. Is public
ii.
Extends Throwable
iii.
Implements Throwable
iv.
Is serializable
Read this piece of code carefully
if("String".trim() == "String".trim())
System.out.println("Equal");
else
System.out.println("Not Equal");
Answers
Read this piece of code
carefully
if( "STRING".toUpperCase() == "STRING")
System.out.println("Equal");
else
System.out.println("Not Equal");
Answers
The following lines of code
byte b = 0;
b += 1;
The following express
char c
= -1;
Which of the following statements
are true?
All the wrapper classes
(Integer, Boolean, Float, Short, Long, Double and Character)