Which of these method of class String is used to remove leading and trailing whitespaces?
Which of these method of DatagramPacket is used to find the port number?
Which of these method of Object class can generate duplicate copy of the object on which it is called?
Which of these cannot be declared static?
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.abstract class A {
2.int i;
3.abstract void display();
4.}
5.class B extends A {
6.int j;
7.void display() {
8.System.out.println(j);
9.}
10.}
11.class Abstract_demo {
12. public static void main(String args[])
13.{
14.B obj = new B();
15.obj.j=2;
16.obj.display();
17.}
18.}
What is the output of this program?
1.class output {
2.public static void main(String args[]) {
3.StringBuffer sb=new StringBuffer("Hello");
4.sb.replace(1,3,"Java");
5.System.out.println(sb);
6.}
7.}
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.}
What will s2 contain after following lines of code?
String s1 = “one”;
String s2 = s1.concat(“two”)
Standard output variable ‘out’ is defined in which class?
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 variable_scope {
2.public static void main(String args[])
3.{
4.int x;
5.x = 5;
6.{
7.int y = 6;
8.System.out.print(x + " " + y);
9.}
10.System.out.println(x + " " + y);
11.}
12.}
What is the output of this program?
1.class string_class {
2.public static void main(String args[])
3.{
4.String obj = "hello";
5.String obj1 = "world";
6.String obj2 = "hello";
7.System.out.println(obj.equals(obj1) + " " + obj.equals(obj2));
8.}
9.}
A class member declared protected becomes member of subclass of which type?
What is the output of this program?
1.class Output {
2.public static void.main(String args[])
3.{
4.int a = 5;
5.int b = 10;
6.first: {
7.second: {
8.third: {
9.if (a == b >> 1)
10.break second;
11.}
12.System.out.println(a);
13.}
14.System.out.println(b);
15.}
16.}
17.}
What is the output of this program?
1.import java.util.*;
2.class Arraylist {
3.public static void main(String args[]) {
4.ArrayList obj1 = new ArrayList();
5.ArrayList obj2 = new ArrayList();
6.obj1.add("A");
7.obj1.add("B");
8.obj2.add("A");
9.obj2.add(1, "B");
10.System.out.println(obj1.equals(obj2));
11.}
12.}
Which of these methods is used to know host of an URL?
Which of these methods is an alternative to getChars() that stores the characters in an array of bytes?
What is the process of defining a method in subclass having same name & type signature as a method in its superclass?
Which of these keyword must be used to inherit a class?
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.clear();
9.System.out.print(obj.size());
10.}
11.}
Which of these cannot be declared static?
Which of the following loops will execute the body of loop even when condition controlling the loop is initially false?
Which of the following loops will execute the body of loop even when condition controlling the loop is initially false?
Which of the following package stores all the standard java classes?
What is the output of relational operators?
Which of these methods is used to retrieve the elements in properties object at specific location?
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 the following package stores all the standard java classes?
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.}
Which of these method of httpd class is used to get report on each hit to HTTP server?
An expression involving byte, int, and literal numbers is promoted to which of these?
Which of these can be returned by the operator & ?
Which of these method of HashSet class is used to add elements to its object?
Which of these class is used to read and write bytes in a file?
Which of these method of class String is used to extract a substring from a String object?
What is the output of this program?
1.class operators {
2.public static void main(String args[])
3.{
4.int x = 8;
5.System.out.println(++x * 3 + " " + x);
6.}
7.}
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.getProtocol());
6.}
7.}
What is the output of this program?
1.class box {
2.int width;
3.int height;
4.int length;
5.int volume;
6.void volume(int height, int length, int width) {
7.volume = width*height*length;
8.}
9.}
10.class Prameterized_method{
11.public static void main(String args[])
12.{
13.box obj = new box();
14.obj.height = 1;
15.obj.length = 5;
16.obj.width = 5;
17.obj.volume(3,2,1);
18.System.out.println(obj.volume);
19.}
20.}
Which of these standard collection classes implements all the standard functions on list data structure?