FileNotFound is a type of IOException
Which method will check whether the specified element is a file or directory?
Java Data Types
Which one of the following are non-primitive data types?
Statement 1- for(int i=0 ; i<10 ;i++)
Statement 2- for(String str : for each )
Find the output of this code. And what will happen when we add the final
keyword in line 1?
What will be the output of the following Java code?
class Output
{
public static void main(String[] args)
{
String[] chars = {"a", "b", "c", "a", "c"};
for (int i = 0; i < chars.length; ++i)
for (int j = i + 1; j < chars.length; ++j)
if (chars[i].equals(chars[j]))
System.out.print(chars[j]);
}
}
What is the output of the following Java code?
import java.util.*;
public class Abekus {
public static void main(String[] args) {
Deque<String> que = new ArrayDeque<String>();
que.add("l");
que.poll();
que.poll();
System.out.println(que.poll());
}
}
What will be the output of the following Java code?
class Abekus {
public static void main(String args[])
{
String Abe1 = "I am intern at Abekus";
String Abe2 = new String(Abe1);
System.out.println((Abe1 == "I am intern at Abekus") + " " + Abe1.equals(Abe2));
}
}
import java.util.*;
class result
{
public static void main(String args[])
{
Hashtable obj = new Hashtable();
obj.put("A", new Integer(3));
obj.put("A", new Integer(3));
obj.put("B", new Integer(2));
obj.put("B", new Integer(2));
obj.put("C", new Integer(8));
obj.put("C", new Integer(8));
System.out.print(obj.contains(new Integer(C)));
}
}
Predict the output of the following Java code:
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
public class Abekus {
public static void main(String[] args)
throws IllegalStateException {
Queue<String> queue
= new LinkedBlockingQueue<String>(2);
System.out.println(queue.offer("b"));
System.out.println(queue.offer("a"));
System.out.println(queue.offer("g"));
}
}