Which of these is an incorrect array declaration?
Which of these process occur automatically by java run time system?
What is the output of this program?
1.import java.util.*;
2.class hashtable {
3.public static void main(String args[]) {
4.Hashtable obj = new Hashtable();
5.obj.put("A", new Integer(3));
6.obj.put("B", new Integer(2));
7.obj.put("C", new Integer(8));
8.obj.remove(new String("A"));
9.System.out.print(obj);
10.}
11.}
What is the output of this program?
1.class conversion {
2.public static void main(String args[])
3.{
4.double a = 295.04;
5.int b = 300;
6.byte c = (byte) a;
7.byte d = (byte) b;
8.System.out.println(c + " " + d);
9.}
10.}
Which of these class object has architecture similar to that of array?
On applying Left shift operator, <<, on an integer bits are lost one they are shifted past which position bit?
What is the output of this program?
1.package pkg;
2.class display {
3.int x;
4.void show() {
5.if (x > 1)
6.System.out.print(x + " ");
7.}
8.}
9.class packages {
10.public static void main(String args[]) {
11.display[] arr=new display[3];
12.for(int i=0;i<3;i++)
13.arr[i]=new display();
14.arr[0].x = 0;
15.arr[1].x = 1;
16.arr[2].x = 2;
17.for (int i = 0; i < 3; ++i)
18.arr[i].show();
19.}
20.}
Which of these packages contain classes and interfaces used for input & output operations of a program?
Which of these is a bundle of information passed between machines?
Which of these standard collection classes implements a linked list data structure?
Which of these is supported by method overriding in Java?
Which of these is a method of class Date which is used to search weather object contains a date before the specified date?
Which of these is wrapper for simple data type char?
Which of the following is incorrect statement about packages?
Which of these method of class StringBuffer is used to concatenate the string representation to the end of invoking string?
What is the output of this program? 1.class mainclass {
2.public static void main(String args[])
3.{
4.boolean var1 = true;
5.boolean var2 = false;
6.if (var1)
7.System.out.println(var1);
8.else
9.System.out.println(var2);
10.}
11.}
Which of these interface is not a member of java.io package?
What is the output of this program?
1.class box {
2.int width;
3.int height;
4.int length;
5.}
6.class mainclass {
7.public static void main(String args[])
8.{
9.box obj = new box();
10.obj.width = 10;
11.obj.height = 2;
12.obj.length = 10;
13.int y = obj.width * obj.height * obj.length;
14.System.out.print(y);
15.}
16.}
Which of these method of MimeHeader is used to return the string equivalent of the values stores on MimeHeader?
Which of this access specifies can be used for a class so that its members can be accessed by a different class in the same package?
Which of these class object can be used to form a dynamic array?
What is the output of this program?
1.class String_demo {
2.public static void main(String args[])
3.{
4.int ascii[] = { 65, 66, 67, 68};
5.String s = new String(ascii, 1, 3);
6.ystem.out.println(s);
7.}
8.}
Which of these data type is returned by every method of OutputStream?
Which of these interface abstractes the output of messages from httpd?
What is the output of this program?
1.class output {
2.public static void main(String args[])
3.{
4.StringBuffer s1 = new StringBuffer("Hello");
5.s1.insert(1,"Java");
6.System.out.println(s1);
7.}
8.}
What is the output of this program?
1.import java.net.*;
2.class networking {
3.public static void main(String[] args) throws MalformedURLException {
4.URL obj = new URL("http://www.sanfoundry.com/javamcq");
5.System.out.print(obj.getPort());
6.}
7.}
Which of these method is used to reduce the capacity of an ArrayList object?
What is the output of this program?
1.import java.util.*;
2.class Bitset {
3.public static void main(String args[]) {
4.BitSet obj = new BitSet(5);
5.for (int i = 0; i < 5; ++i)
6.obj.set(i);
7.obj.clear(2);
8.System.out.print(obj);
9.}
10.}
-
-
-
-
What is the output of this program?
1.class Modulus {
2. public static void main(String args[])
3.{
4.double a = 25.64;
5.int b = 25;
6.a = a % 10;
7.b = b % 10;
8.System.out.println(a + " " + b);
9.}
10.}
Which of these method of class String is used to extract a single character from a String object?
Which of these method is used to change an element in a LinkedList Object?
In below code, what can directly access and change the value of the variable name?
1.package test;
2.class Target
3.{
4.public String name = "hello";
5.}
What is the value of “d” after this line of code has been executed?
double d = Math.round ( 2.5 + Math.random() );
Which of these class can encapsulate an entire executing program?
Which of these keywords can be used to prevent inheritance of a class?
What is the output of this program?
1.import java.util.*;
2.class Maps {
3.public static void main(String args[]) { 4.TreeMap obj = new TreeMap();
5.obj.put("A", new Integer(1));
6.obj.put("B", new Integer(2));
7.obj.put("C", new Integer(3));
8.System.out.println(obj.entrySet());
9.}
10.}
Which of these method of DatagramPacket is used to obtain the byte array of data contained in a datagram?
What is the output of this program?
1.import java.util.*;
2.class Maps {
3. public static void main(String args[]) {
4.HashMap obj = new HashMap(); 5.obj.put("A", new Integer(1));
6.obj.put("B", new Integer(2));
7.obj.put("C", new Integer(3)); 8.System.out.println(obj.keySet());
9.}
10.}
Which of these methods can be used to obtain set of all keys in a map?
Which of the following are legal lines of Java code? 1. int w = (int)888.8; 2.byte x = (byte)100L; 3.long y = (byte)100; 4.byte z = (byte)100L;