What is HotJava?
Select the correct option that gives compile-time errors in this code.
Which of these methods of the Java String class is used to remove leading and trailing whitespaces?
class test{
public static void main (String[] args) {
int x=1,y=16;
x=x>>2;
y=y>>x;
System.out.println(x);
}
}
class GFG {
public static void main (String[] args) {
byte x = (byte)64;
int i;
byte y;
i = x>>3;
y = (byte) (x<<2);
System.out.print(~i + " " +y);
}
}
Predict the output of the following Java code.
class Abekus {
protected int a, b;
}
class Abekusmain {
public static void main(String args[]) {
Abekus o = new Abekus();
System.out.println(o.a + " " + o.b);
}
What is the output of the following Java code?
class Abekus {
static int i = 10;
public static void main(String[] args) {
Abekus o1 = new Abekus();
Abekus o2 = new Abekus();
o1.i = 20;
System.out.print(o1.i + " ");
System.out.println(o2.i);
}
}
Predict the output of the following Java code:
import java.util.*;
public class Abekus {
public static void main(String[] args) {
LinkedList l = new LinkedList();
l.add(6);
l.add(8);
l.add(4);
l.add(2);
System.out.println(l.pollFirst());
System.out.println(l.pollLast());
}
}
Predict the output of the following Java code.
class Abekus {
void abbu() {
String s = "Hey, ";
String s1 = dabbu(s);
String s2 = " How are";
System.out.print(":"+s2 + s1); }
String dabbu(String s) {
s = s + "Abekus Learner! ";
System.out.print(s);
return " you?"; }
public static void main(String[] args) {
Abekus o = new Abekus();
o.abbu(); }
}
import java.util.*;
class output
{
public static void main(String args[])
{
LinkedList set = new LinkedList();
set.add("A");
set.add("B");
set.add("C");
set.add("D");
set.addFirst("F");
set.addLast("G");
Iterator i = set.iterator();
Collections.reverse(set);
Collections.shuffle(set);
System.out.println(set.pollFirst()+" "+set.peekLast());
System.out.println(set.peekFirst()+" "+set.pollLast());
}
}