What is the output of this program?
1.class box {
2.int width;
3.int height;
4.int length;
5.int volume;
6.box() {
7.width = 5;
8.height = 5;
9.length = 6;
10.}
11.void volume() {
12.volume = width*height*length;
13.}
14.}
15.class constructor_output {
16.public static void main(String args[])
17.{
18.box obj = new box();
19.obj.volume();
20.System.out.println(obj.volume);
21.}
22.}
Which of these methods can be used to search an element in a list?
What is the output of this program?
1.class output {
2.public static void main(String args[])
3.{
4.String c = " Hello World ";
5.String s = c.trim();
6.System.out.println("\""+s+"\"");
7.}
8.}
What is the output of this program?
1.import java.util.*;
2.class Output {
3.public static void main(String args[]) {
4.HashSet obj = new HashSet();
5.obj.add("A");
6.obj.add("B");
7.obj.add("C");
8.System.out.println(obj + " " + obj.size());
9}
10.}
What is the output of this program?
1.class A {
2.public int i;
3.private int j;
4.}
5.class B extends A {
6.void display() {
7.super.j = super.i + 1;
8.System.out.println(super.i + " " + super.j);
9.}
10.}
11.class inheritance {
12.public static void main(String args[])
13.{
14.B obj = new B();
15.obj.i=1;
16.obj.j=2;
17.obj.display();
18.}
19.}
Which of these method of DatagramPacket class is used to find the destination address?
Which of these is a wrapper for data type int?
Which of these class relies upon its subclasses for complete implementation of its methods?
Which of these methods is used to know host of an URL?
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 is specified by a File object?
What is the output of this program?
1.class Output {
2.public static void main(String args[])
3.{
4.int x , y = 1;
5.x = 10;
6.if (x != 10 && x / 0 == 0)
7.System.out.println(y);
8.else
9.System.out.println(++y);
10.}
11.}
Which of these keyword must be used to inherit a class?
What is the output of this program?
1.class evaluate {
2.public static void main(String args[])
3.{
4.int a[] = {1,2,3,4,5};
5.int d[] = a;
6.int sum = 0;
7.for (int j = 0; j < 3; ++j)
8.sum += (a[j] * d[j + 1]) + (a[j + 1] * d[j]);
9.System.out.println(sum);
10.}
11.}
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.StringBuffer s2 = s1.reverse();
6.System.out.println(s2);
7.}
8.}
What is the output of this program?
1.import java.util.*;
2.class Linkedlist {
3.public static void main(String args[]) {
4.LinkedList obj = new LinkedList();
5.obj.add("A");
6.obj.add("B");
7.obj.add("C");
8.obj.addFirst("D");
9.System.out.println(obj);
10.}
11.}
-
-
-
-
What is the output of this program?
1.class test {
2.int a;
3.int b;
4.test(int i, int j) {
5.a = i;
6.b = j;
7.}
8.void meth(test o) {
9.o.a *= 2;
10.O.b /= 2;
11.}
12.}
13.class Output {
14.public static void main(String args[])
15.{
16.test obj = new test(10 , 20);
17.obj.meth(obj); 18.System.out.println(obj.a + " " + obj.b); }
19.}
Which of these can be used to fully abstract a class from its implementation?
What is the output of this program?
1.class c {
2.public void main( String[] args )
3.{
4.System.out.println( "Hello" + args[0] );
5.}
6.}
Which of these keywords is used to make a class?
Which of the following operators can operate on a boolean variable? && == ?:
+=
What is the output of this program? 1.class increment {
2.public static void main(String args[])
3.{
4.int g = 3;
5.System.out.print(++g * 8);
6.}
7.}
Which of these methods is used to retrieve elements in BitSet object at specific location?
What is the output of this program?
1.class Output {
2.public static void main(String args[])
3.{
4.int a = 1;
5.int b = 2;
6.int c = 3;
7.a |= 4;
8.b >>= 1;
9. c <<= 1;
10.a ^= c;
11.System.out.println(a + " " + b + " " + c);
12.}
13.}
What is the output of this program?
1.class Output {
2.public static void main(String args[]) {
3.byte a[] = { 65, 66, 67, 68, 69, 70 };
4.byte b[] = { 71, 72, 73, 74, 75, 76 };
5.System.arraycopy(a, 1, b, 3, 0);
6.System.out.print(new String(a) + " " + new String(b));
7.}
8.}
What is the value returned by unction compareTo() if the invoking string is less than the string compared?
Which of these method of DatagramPacket is used to find the port number?
What is the output of this program?
1.class Output {
2.public static void main(String args[]) {
3.Integer i = new Integer(257);
4.float x = i.floatValue();
5.System.out.print(x);
6.}
7.}
What is the output of the following code?
1.class San
2.{
3.public void m1 (int i,float f)
4.{
5.System.out.println(" int float method");
6.}
7.public void m1(float f,int i);
8.{
9.System.out.println("float int method");
10.}
11.public static void main(String[]args)
12.{
13.San s=new San();
14.s.m1(20,20);
15.}
16.}
Which of the following operators can operate on a boolean variable? && == ?:
+=
Which of these method is used to change an element in a LinkedList Object
Which of these method can be used to increase the capacity of ArrayList object manually?
What is the output of this program?
1.class Alligator
2.{
3.public static void main(String[] args)
4.{
5.int []x[] = {{1,2}, {3,4,5}, {6,7,8,9}};
6.int [][]y = x;
7.System.out.println(y[2][1]);
8.}
9.}
Which operator is used by Java run time implementations to free the memory of an object when it is no longer needed?
What is the output of this program?
1.class Output {
2.public static void main(String args[])
3.{
4.int a1[] = new int[10];
5.int a2[] = {1, 2, 3, 4, 5}; 6.System.out.println(a1.length + " " + a2.length);
7.}
8.}
What is the value returned by unction compareTo() if the invoking string is less than the string compared?
Which of these method of MimeHeader is used to return the string equivalent of the values stores on MimeHeader?
What will s2 contain after following lines of code?
String s1 = “one”;
String s2 = s1.concat(“two”)
Which of these keywords is used by a class to use an interface defined previously?