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 can be overloaded?
Which of these class holds a collection of static methods and variables?
Which of these process occur automatically by java run time system?
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 of these statements are incorrect?
What is the output of this program?
1.class leftshift_operator {
2.public static void main(String args[])
3.{
4.byte x = 64;
5.int i;
6. byte y;
7.i = x << 2;
8.y = (byte) (x << 2)
9.System.out.print(i + " " + y);
10.}
11.}
Which of these method of ArrayList class is used to obtain present size of an object?
What is the output of this program?
1.import java.io.*;
2.public class filesinputoutput {
3.public static void main(String[] args) {
4.String obj = "abc";
5.byte b[] = obj.getBytes();
6.ByteArrayInputStream obj1 = new ByteArrayInputStream(b);
7.for (int i = 0; i < 2; ++ i) {
8.int c;
9.while ((c = obj1.read()) != -1) {
10.if (i == 0) {
11.System.out.print(Character.toUpperCase((char)c));
12.obj2.write(1);
13.}
14.}
15.System.out.print(obj2);
16.}
17.}
18.}
Which of these class relies upon its subclasses for complete implementation of its methods?
What is the output of this program?
1.class rightshift_operator {
2.public static void main(String args[])
3.{
4.int x;
5.x = 10;
6.x = x >> 1;
7.System.out.println(x);
8.}
9.}
What is the value returned by function compareTo() if the invoking string is greater than the string compared?
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 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 MimeHeader is used to return the string equivalent of the values stores on MimeHeader?
Which of these is an on correct statement?
Which of these methods is used to retrieve the elements in properties object at specific location?
Which of these method of class String is used to compare two String objects for their equality?
Which of the following methods is a method of wrapper Integer for obtaining hash code for the invoking object?
What is the output of this program?
1.class Output {
2.public static void main(String args[]) {
3.Integer i = new Integer(257);
4.byte x = i.byteValue();
5.System.out.print(x);
6.}
7.}
Which operator is used to invert all the digits in binary representation of a number?
Which of these object stores association between keys and values?
What is the output of this program?
1.class Output {
2.public static void main(String args[]) {
3.char a[] = {'a', '5', 'A', ' '};
4.System.out.print(Character.isDigit(a[0]) + " ");
5.System.out.print(Character.isWhitespace(a[3]) + " "); 6.System.out.print(Character.isUpperCase(a[2]));
7.}
8.}
Which of these method is used to calculate number of bits required to hold the BitSet object?
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.}
-
-
-
-
Which of these method is used to reduce the capacity of an ArrayList object?
Which of these is wrapper for simple data type float?
Which of the following statements are incorrect?
Which of these class is used to encapsulate IP address and DNS?
Which of these method of Object class is used to obtain class of an object at run time?
Which of the following are incorrect form of StringBuffer class constructor?
Which of these are legacy classes?
What is the output of this program? 1.class asciicodes {
2.public static void main(String args[])
3.{
4.char var1 = 'A';
5.char var2 = 'a';
6.System.out.println((int)var1 + " " + (int)var2);
7.}
8.}
What is the output of this program, if we run as “java main_arguments 1 2 3”? 1.class main_arguments {
2.public static void main(String [] args)
3. {
4.String [][] argument = new String[2][2];
5.int x;
6.argument[0] = args;
7.x = argument[0].length;
8.for (int y = 0; y < x; y++)
9.System.out.print(" " + argument[0][y]);
10.}
11.}
Which of these method can be used to increase the capacity of ArrayList object manually?
Which of these method of httpd class is used to write UrlCacheEntry object into local disk?
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.}
Which of these statement is incorrect?
At line number 2 below, choose 3 valid data-type attributes/qualifiers among “final, static, native, public, private, abstract, protected”
public interface Status
{
/* insert qualifier here */ int MY_VALUE = 10;
}
Which of these data type is returned by every method of OutputStream?