What is the output of this program?
1.class static_out {
2.static int x;
3.static int y;
4.void add(int a , int b){
5.x = a + b;
6.y = x + b;
7.}
8.}
9.class static_use {
10.public static void main(String args[])
11.{
12.static_out obj1 = new static_out();
13.static_out obj2 = new static_out();
14.int a = 2;
15.obj1.add(a, a + 1);
16.obj2.add(5, a);
17.System.out.println(obj1.x + " " + obj2.y);
18.}
19.}
What is the output of this program?
1.package pkg;
2.class output {
3.public static void main(String args[])
4.{
5.StringBuffer s1 = new StringBuffer("Hello World");
6.s1.insert(6 , "Good ");
7.System.out.println(s1);
8.}
9.}
What is the output of this program?
1.class A {
2.int i;
3.int j;
4.A() {
5.i = 1;
6. j = 2;
7.}
8.}
9.class Output {
10.public static void main(String args[])
11.{
12.A obj1 = new A();
13.System.out.print(obj1.toString());
14.}
15.}
Which of these methods is used to know host of an URL?
Which of these is a wrapper for data type int?
What is the output of this program?
1.import java.util.*;
2.class Array {
3.public static void main(String args[]) {
4.int array[] = new int [5];
5.for (int i = 5; i > 0; i--)
6.array[5 - i] = i;
7.Arrays.sort(array);
8.for (int i = 0; i < 5; ++i)
9.System.out.print(array[i]);;
10.}
11.}
What is the output of this program?
1.import java.util.*;
2.class Output {
3.public static void main(String args[]) {
4.ArrayList obj = new ArrayList();
5.obj.add("A");
6.obj.ensureCapacity(3); 7.System.out.println(obj.size());
8.}
9.}
Which of these operators can be used to concatenate two or more String objects?
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.System.out.println(obj);
11.}
12.}
What will s2 contain after following lines of code?
String s1 = “one”;
String s2 = s1.concat(“two”)
Which of the following is a method having same name as that of it’s class?
What is the return type of Constructors?
Which of these method is used to make a bit zero specified by the index?
Which of these method of Object class is used to obtain class of an object at run time?
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.}
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 access specifiers must be used for main() method?
Which of the following statements are incorrect?
What is the output of this program?
1.class Output {
2.public static void main(String args[])
3.{
4.final int a=10,b=20;
5.while(a
What is the range of byte data type in Java?
What is the return type of a method that does not returns any value?
What is the output of this program?
1.import java.util.*;
2.class Array {
3.public static void main(String args[]) {
4.int array[] = new int [5];
5.for (int i = 5; i > 0; i--)
6.array[5 - i] = i;
7.Arrays.sort(array);
8.System.out.print(Arrays.binarySearch(9.array, 4));
10.}
11.}
What is the output of this program?
1.class A {
2.final public int calculate(int a, int b) { return 1; }
3.}
4.class B extends A {
5.public int calculate(int a, int b) { return 2; }
6.}
7.public class output {
8.public static void main(String args[])
9.{
10.B object = new B();
11.System.out.print("b is b.calculate(0, 1));
12.}
13.}
Which of these is correct way of calling a constructor having no parameters, of superclass A by subclass B?
What is the output of this program?
1.class bitwise_operator {
2.public static void main(String args[])
3.{
4.int a = 3;
5.int b = 6;
6.int c = a | b;
7.int d = a & b;
8.System.out.println(c + " " + d);
9.}
10.}
What is the output of this program?
1.class jump_statments {
2.public static void main(String args[])
3.{
4.int x = 2;
5.int y = 0;
6.for ( ; y < 10; ++y) {
7.if (y % x == 0)
8.continue;
9.else if (y == 8)
10.break;
11.else
12.System.out.print(y + " ");
13.}
14.}
15.}
Which of these is correct about passing an argument by call-by-value process?
What is the output of this program?
1.class String_demo {
2. public static void main(String args[])
3.{
4.char chars[] = {'a', 'b', 'c'};
5.String s = new String(chars);
6.System.out.println(s);
7.}
8.}
Which of these methods is used to know the full URL of an URL object?
Literals in java must be appended by which of these?
What is the output of this program?
1.class output {
2.public static void main(String args[])
3.{
4.StringBuffer c = new StringBuffer("Hello");
5.System.out.println(c.length());
6. }
7. }
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.import java.io.*;
2.class files {
3.public static void main(String args[]) {
4.File obj = new File("/java/system");
5.System.out.print(obj.getName());
6.}
7.}
What is the output of this program?
1.import java.util.*;
2.class Arraylist {
3.public static void main(String args[]) {
4.ArrayList obj = new ArrayList();
5.obj.add("A");
6.obj.add("B");
7.obj.add("C");
8.obj.add(1, "D");
9.System.out.println(obj);
10.}
11.}
-
-
-
-
What is the output of this program? 1.class string_demo {
2.public static void main(String args[])
3.{
4.String obj = "I" + "like" + "Java";
5.System.out.println(obj);
6.}
7.}
Which of these operators can be used to concatenate two or more String objects?
Which of these methods must be made static?
What is the output of this program?
1.class bool_operator {
2. public static void main(String args[])
3. {
4. boolean a = true;
5.boolean b = !true;
6.boolean c = a | b;
7.boolean d = a & b;
8.boolean e = d ? b : c;
9.System.out.println(d + " " + e);
10.}
11.}
Which of these method of class StringBuffer is used to extract a substring from a String object?