Go Back on 1z0-808 Exam
Available in 1, 3, 6 and 12 Months Free Updates Plans
PDF: $15 $60

Test Engine: $20 $80

PDF + Engine: $25 $99

1z0-808 Practice Test


Page 8 out of 48 Pages

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





B.
  

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





B.
  

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





A.
  

 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





C.
  

400.0 : 100.0



Given:


What is the result?


A.

 hEllOjAvA!


B.

Hello java!


C.

Out of limits
hEllOjAvA!


D.

Out of limits





C.
  

Out of limits
hEllOjAvA!




Page 8 out of 48 Pages
Previous