Select the output of Java Program
Description: You will be given sample program or statement, Select appropriate output or statement from the given option | |
Number of Questions: 20 | |
Created by: Aliensbrain Bot | |
Tags: java programming language |
Attempted
0/20
Correct 0
Score 0
‹
›
Syntax of System.arraycopy
method??
Is Multiple Inheritance allowed in JAVA???
Is typecasting is allowed between two different objects of different classes???
clone method used for..???
String name="ALIEN";
name.reverse();
Is code successfully compiled..???
int x = 10;
do {
x--;
} while (x < 10);
How many times the loop will be executed?
int x = 0;
int y = 10;
do {
y--;
++x;
} while (x < 5);
System.out.print(x + "," + y);
What is the result?
public static void main(String[] args) {
Integer i = new Integer(1) + new Integer(2);
switch (i) {
case 3:
System.out.println("three");
break;
default:
System.out.println("other");
break;
}
}
What is the output?
String[] elements = {
"for",
"tea",
"too"
};
String first = (elements.length > 0) ? elements[0] : null;
What is the result?
int x = 12;
while (x < 10) {
x--;
}
System.out.print(x);
What is the result?
NumberFormat nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(4);
nf.setMinimumFractionDigits(2);
String a = nf.format(3.1415926);
String b = nf.format(2);
Which statement is true about the result?
public class Yippee2 {
static public void main(String [] yahoo) {
for(int x = 1; x < yahoo.length; x++) {
System.out.print(yahoo[x] + " ");
}
}
}
and the command line invocation: java Yippee2 a b c
What is the result?
public static void main(String[] args) {
String str = "null";
if (str == null) {
System.out.println("null");
} else (str.length() == 0) {
System.out.println("zero");
} else {
System.out.println("some");
}
}
What is the result?
String[] elements = { "for", "tea", "too" };
String first = (elements.length > 0) ? elements[0] : null;
What is the result?
public class CreditCard {
private String cardID;
private Integer limit;
public String ownerName;
public void setCardInformation(String cardID, String ownerName, Integer limit) {
this.cardID = cardID;
this.ownerName = ownerName;
this.limit = limit;
}
}
Which statement is true?
int x = 12;
while (x < 10) {
x--;
}
System.out.print(x);
What is the result?