Given the code fragment:
public static void main(String[] args) {
int iArray[] = {65, 68, 69};
iArray[2] = iArray[0];
iArray[0] = iArray[1];
iArray[1] = iArray[2];
for (int element : iArray) {
System.out.print(element + " ");
}
A.
68, 65, 69
B.
68, 65, 65
C.
65, 68, 65
D.
65, 68, 69
E.
Compilation fails
68, 65, 65
Given:
public class Equal {
public static void main(String[] args) {
String str1 = "Java";
String[] str2 = {"J","a","v","a"};
String str3 = "";
for (String str : str2) {
str3 = str3+str;
}
boolean b1 = (str1 == str3);
boolean b2 = (str1.equals(str3));
System.out.print(b1+", "+b2);
}
What is the result?
A.
true, false
B.
false, true
C.
true, true
D.
false, false
false, true
strict equality.
equals compare state, not identity
Which usage represents a valid way of compiling java source file with the name "Main"?
A.
javac Main.java
B.
java Main.class
C.
java Main.java
D.
javac Main
E.
java Main
javac Main.java
The compiler is invoked by the javac command. When compiling a Java
class, you must include the file name, which houses the main classes including the Java
extension. So to run Main.java file we have to use command in option A.
TO execute Java program we can use Java command but can't use it for compiling.
https://docs.oracle.com/javase/tutorial/getStarted/application/index.html
Given:
What is the result?
A.
200.0 : 100.0
B.
400.0 : 200.0
C.
400.0 : 100.0
D.
Compilation fails
400.0 : 100.0
Given:
What is the result?
A.
hEllOjAvA!
B.
Hello java!
C.
Out of limits
hEllOjAvA!
D.
Out of limits
Out of limits
hEllOjAvA!
Page 8 out of 48 Pages |
Previous |