Which of these keywords can be used to prevent inheritance of a class?
Which of these is an instance variable of class httpd?
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.}
Which of these can not be used for a variable name in Java?
Which of these statements are incorrect?
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.canWrite());
6.System.out.print(" " + obj.canRead());
7.}
8.} Note: file is made in c drive.
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 remove leading and trailing whitespaces?
What is the output of this program?
1.import java.net.*;
2.class networking {
3.public static void main(String[] args) throws Exception {
4.URL obj = new URL("http://www.sanfoundry.com/javamcq");
5.URLConnection obj1 = obj.openConnection();
6.int len = obj1.getContentLength();
7.System.out.print(len);
8.}
9.}
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.}
Which of these class is used for operating on request from the client to the server?
What is the output of this program?
1.import java.net.*;
2.class networking {
3.public static void main(String[] args) throws Exception {
4.URL obj = new URL("http://www.sanfoundry.com/javamcq");
5.URLConnection obj1 = obj.openConnection(); 6.System.out.print(obj1.getLastModified);
7.}
8.}
Note: Host URL was last modified on july 18 tuesday 2013 .
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.}
Which of these method of class String is used to remove leading and trailing whitespaces?
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.System.out.print(obj.contains(new Integer(5)));
9.}
10.}
What is the output of this program?
1.import java.net.*;
2.class networking {
3.public static void main(String[] args) throws Exception {
4.URL obj = new URL("http://www.sanfoundry.com/javamcq");
5.URLConnection obj1 = obj.openConnection();
6.System.out.print(obj1.getContentType());
7.}
8.}
Which of these classes is used for input and output operation when working with bytes?
Which of these keywords is used to define packages in Java?
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 is the output of this program?
1.import java.util.*;
2.class vector {
3.public static void main(String args[]) {
4.Vector obj = new Vector(4,2);
5.obj.addElement(new Integer(3));
6.obj.addElement(new Integer(2));
7.obj.addElement(new Integer(5)); 8.System.out.println(obj.capacity());
9.}
10.}
Which of these keywords is used to make a class?
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.}
What is the output of this program?
1.class A {
2.public int i;
3.protected int j;
4.}
5.class B extends A {
6.int j;
7.void display() {
8.super.j = 3;
9.System.out.println(i + " " + j);
10.}
11.}
12.class Output {
13.public static void main(String args[])
14.{
15. B obj = new B();
16.obj.i=1;
17.obj.j=2;
18.obj.display();
19.}
20.}
Which API gets the SocketAddress (usually IP address + port number) of the remote host that this packet is being sent to or is coming from.
Which of these method of class StringBuffer is used to find the length of current character sequence?
What is the value returned by unction compareTo() if the invoking string is less than the string compared?
Which of these class is used to create an object whose character sequence is mutable?
Which of these class can encapsulate an entire executing program?
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.length() + " " + obj.size());
9.}
10.}
Which of these methods is an alternative to getChars() that stores the characters in an array of bytes?
Which API gets the SocketAddress (usually IP address + port number) of the remote host that this packet is being sent to or is coming from.
Which of these class is used to access actual bits or content information of a URL?
What is the output of this program?
1. import java.net.*;
2.class networking {
3.public static void main(String[] args) throws Exception {
4.URL obj = new URL("http://www.sanfoundry.com/javamcq");
5.URLConnection obj1 = obj.openConnection();
6.System.out.print(obj1.getContentType());
7.}
8.}
Note: Host URL is written in html and simple text.
Which of these statement is incorrect?
Which of these method of DatagramPacket is used to find the length of byte array?
Which of these method of class String is used to extract more than one character at a time a String object?
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.}
What is the output of relational operators?
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 class is not related to input and output stream in terms of functioning?