Which of these classes is super class of Exception class?
Which class is the superclass of the String and StringBuffer classes?
Which of these keywords is used to enclose the block of code that needs to be checked for exceptions?
public class operators {
public static void main(String[] args)
{
int a = 20, b = 10, c = 0;
a = b++ + c;
System.out.println(b);
}
}
Predict the output of the following Java code:
class Abekus {
static int i = 1;
public static void main(String[] args)
{
for (int i = 1; i < 12; i++) {
i = i + 2;
System.out.print(i + " ");
}
}
}
both statement/code are same or not
Statement 1
class x{
public void m1(){
if(true){
throw new RTE("Abekus");
}
}
}
--------------------------------------------
Statement 2
class x{
public void m2() throws RTE {
if(true){
throw new RTE("Abekus")
}
}
}
Predict the output of the following Java code:
class Abekus {
public static void swap(Integer a, Integer b) {
Integer temp = a;
a = b;
b = temp;
}
public static void main(String[] args) {
Integer a = new Integer(55);
Integer b = new Integer(68);
swap(a, b);
System.out.println("a = " + a + ", b = " + b); }
}
Predict the output of the following Java code:
class Abekus {
public static void main(String args[])
{
String str = "Java Programming";
String str1 = "Java";
String str2 = str.substring(7);
System.out.println(str2);
System.out.println(str.substring(7, 11));
}
}
Predict the output of the following Java code.
import java.util.*;
public class Abekus {
public static void main(String[] args) {
List<String> l = new ArrayList<String>();
l.add("d");
l.add("f");
l.add("a");
l.add("g");
l.add("b");
Collections.rotate(l, 2);
System.out.println(l);
}
}