Proper study guides for Avant-garde Oracle Java SE 8 Programmer I certified begins with Oracle 1z0-808 preparation products which designed to deliver the Downloadable 1z0-808 questions by making you pass the 1z0-808 test at your first time. Try the free 1z0-808 demo right now.

2021 Nov 1z0-808 real exam

Q121. Given: 

What is result? 

A. Successful 

B. Unsuccessful 

C. Compilation fails 

D. An exception is thrown at runtime 


Q122. Given the following code for the classes MyException and Test: 

What is the result? 

A. A 

B. B 

C. Either A or B 

D. A B 

E. A compile time error occurs at line n1 


Q123. Given: 

public class ComputeSum { 

public int x; 

public int y; 

public int sum; 

public ComputeSum (int nx, int ny) { 

x = nx; y =ny; 


public void setX(int nx) { x = nx; updateSum();} 

public void setY(int ny) { x = ny; updateSum();} 

void updateSum() { sum = x + y;} 

This class needs to protect an invariant on the sum field. 

Which three members must have the private access modifier to ensure that this invariant is maintained? 

A. The x field 

B. The y field 

C. The sum field 

D. The ComputerSum ( ) constructor 

E. The setX ( ) method 

F. The setY ( ) method 

Answer: C,E,F 

Explanation: The sum field and the two methods (setX and SetY) that updates the sum field. 

Q124. What is the name of the Java concept that uses access modifiers to protect variables and hide them within a class? 

A. Encapsulation 

B. Inheritance 

C. Abstraction 

D. Instantiation 

E. Polymorphism 


Q125. Given: 

What is the result? 

A. simaple A 

B. Capital A 

C. simaple A default Capital A 

D. simaple A default 

E. Compilation fails. 



Here we have to use two ternary operators combined. SO first we can use to check first 

condition which is x > 10, as follows; 

x>10?">": (when condition false) Now we have to use another to check if x<10 as follows; 

x<10?V:"=" We can combine these two by putting last ternary statement in the false 

position of first ternary statement as follows; 



Renovate 1z0-808 sample question:

Q126. Given the class definitions: 

And the code fragment of the main() method, 

What is the result? 

A. Java Java Java 

B. Java Jeve va 

C. Java Jeve ve 

D. Compilation fails 


Q127. Which two are valid array declaration? 

A. Object array[]; 

B. Boolean array[3]; 

C. int[] array; 

D. Float[2] array; 

Answer: A,C 

Q128. You are asked to develop a program for a shopping application, and you are given the following information: 

. The application must contain the classes Toy, EduToy, and consToy. The Toy class is the superclass of the other two classes. 

. The int caicuiatePrice (Toy t) method calculates the price of a toy. 

. The void printToy (Toy t) method prints the details of a toy. 

Which definition of the Toy class adds a valid layer of abstraction to the class hierarchy? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 


Q129. Which usage represents a valid way of compiling java source file with the name "Main"? 

A. javac 

B. java Main.class 

C. java 

D. javac Main 

E. java Main 


Explanation: 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 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. 

Q130. Given the code fragment: 

Assume that the system date is June 20, 2014. What is the result? 

A. Option A 

B. Option B 

C. Option C 

D. Option D