Which method can be defined only once in a program?
With x = 0, which of the following are legal lines of Java code for changing the value of x to 1? 1. x++;
2. x = x + 1;
3. x += 1;
4. x =+ 1;
Decrement operator, −−, decreases value of variable by what number?
Which operator is used by Java run time implementations to free the memory of an object when it is no longer needed?
Which of these operators is used to allocate memory to array variable in Java?
Which of these operators can skip evaluating right hand operand?
Which of the following is method of wrapper Integer for converting the value of an object into int?
Which of these is returned by “greater than”, “less than” and “equal to” operators
Which of these method of DatagramPacket class is used to find the destination address?
What is the output of this program?
1.class output {
2.public static void main(String args[])
3.{
4.String s1 = "one";
5.String s2 = s1 + " two";
6.System.out.println(s2);
7.}
8.}
What is the return type of a method that does not returns any value?
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 .
Which of these class is used to create servers that listen for either local or remote client programs?
Which of these is an on correct statement?
What is the output of this program?
1.class String_demo {
2.public static void main(String args[])
3.{
4.int ascii[] = { 65, 66, 67, 68};
5.String s = new String(ascii, 1, 3);
6.ystem.out.println(s);
7.}
8.}
Which of these is not a bitwise operator?
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 return type of Constructors?
Which of these classes is not included in java.lang?
Which of these method of DatagramPacket is used to find the length of byte array?
Which of the following operators can operate on a boolean variable? && == ?:
+=
Which of these is an instance variable of class httpd?
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.String s1 = "abcd";
7.int len1 = s1.length();
8.int len2 = s.length();
9.System.out.println(len1 + " " + len2);
10.}
11.}
Which of the following are legal lines of Java code? 1. int w = (int)888.8; 2.byte x = (byte)100L; 3.long y = (byte)100; 4.byte z = (byte)100L;
Which of these is returned by “greater than”, “less than” and “equal to” operators
Which of these statement is incorrect?
What is the output of this program?
1.class isNaN_output {
2.public static void main(String args[]) {
3.Double d = new Double(1 / 0.);
4.boolean x = d.isNaN();
5.System.out.print(x);
6.}
7.}
Which of these classes implements Set interface?
Which of these class is used to create an object whose character sequence is mutable?
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 object uses key to store value?
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 one is a valid declaration of a boolean?
Which of these is a super class of wrappers Long, Character & Integer?
In below code, what can directly access and change the value of the variable name?
1.package test;
2.class Target
3.{
4.public String name = "hello";
5.}
Which of these statement is incorrect?
Which of these operators is used to allocate memory to array variable in Java?
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. }
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.}
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. }