we provide Virtual Oracle 1Z0-804 free draindumps which are the best for clearing 1Z0-804 test, and to get certified by Oracle Java SE 7 Programmer II Exam. The 1Z0-804 Questions & Answers covers all the knowledge points of the real 1Z0-804 exam. Crack your Oracle 1Z0-804 Exam with latest dumps, guaranteed!

♥♥ 2021 NEW RECOMMEND ♥♥

Free VCE & PDF File for Oracle 1Z0-804 Real Exam (Full Version!)

★ Pass on Your First TRY ★ 100% Money Back Guarantee ★ Realistic Practice Exam Questions

Free Instant Download NEW 1Z0-804 Exam Dumps (PDF & VCE):
Available on: http://www.surepassexam.com/1Z0-804-exam-dumps.html

Q81. Given: What is the result? 

A. 1 1 1 1 1 

B. 1 2 3 4 5 

C. 0 1 2 3 4 

D. 0 1 4 3 4 



first for-loop set 0 0 0 0 0 second for-loop increments each to 1 1 1 1 1 if condition is not given 

Q82. Given: 

Which group of method is moved to a new class when implementing the DAO pattern? 

A. public in getId () 

public String getContractDetails () 

public Void setContractDetails(String contactDetails) 

public String getName () 

public void setName (String name) 

B. public int getId () 

public String getContractDetails() 

public String getName() 

public Person getPerson(int id) throws Exception 

C. public void setContractDetails(String contractDetails) public void setName(String name) 

D. public Person getPerson(int id) throws Exception 

public void createPerson(Person p) throws Exception 

public void deletePerson(int id) throws Exception 

public void updatePerson(Person p) throws Exception 



The methods related directly to the entity Person is moved to a new class. 


Note:DAO Design Pattern 

*Abstracts and encapsulates all access to a data source *Manages the connection to the 

data source to obtain 

and store data *Makes the code independent of the data sources and data vendors (e.g. 

plain-text, xml, LDAP, 

MySQL, Oracle, DB2) 

D:\Documents and Settings\useralbo\Desktop\1.jpg 

Example (here Customer is the main entity): 

public class Customer { 

private final String id; 

private String contactName; 

private String phone; 

public void setId(String id) { this.id = id; } 

public String getId() { return this.id; } 

public void setContactName(String cn) { this.contactName = cn;} public String 

getContactName() { return 

this.contactName; } public void setPhone(String phone) { this.phone = phone; } public 

String getPhone() 

{ return this.phone; } 

public interface CustomerDAO { 

public void addCustomer(Customer c) throws DataAccessException; public Customer 

getCustomer(String id) 

throws DataAccessException; public List getCustomers() throws DataAccessException; 

public void 

removeCustomer(String id) throws DataAccessException; public void 

modifyCustomer(Customer c) throws 

DataAccessException; } 

Q83. Given: What is the result? 

A. Both const and inner will be in the output. 

B. Only const will be in the output. 

C. Compilation fails due to an error on line A. 

D. Compilation fails due to an error on line B. 

E. An Exception is thrown at runtime. 



The code compiles fine. Note:The Runnable interface should be implemented by any class whose instances are intended to beexecuted by a thread. The class must define a method of no arguments called run. This interface is designed to provide a common protocol for objects that wish to execute code while they areactive. For example, Runnable is implemented by class Thread. Being active simply means that a thread hasbeen started and has not yet been stopped. 

In addition, Runnable provides the means for a class to be active while not subclassing Thread. Aclass that implements Runnable can run without subclassing Thread by instantiating a Thread instance andpassing itself in as the target. In most cases, the 

Runnable interface should be used if you are only planning tooverride the run() method and 

no other Thread methods. This is important because classes should not besubclassed 

unless the programmer intends on modifying or enhancing the fundamental behavior of the 


Note 2:start() 

Causes this thread to begin execution; the Java Virtual Machine calls the run method of 

this thread. 


Interface Runnable 

Q84. Give: 

What is the result? 

A. There are 27 sports cars and 5 trucks 

B. There are 27 convertibles and 5 trucks 

C. There are 9 sports cars and 5 trucks 

D. There are 9 convertibles and 5 trucks 

E. IllegalFormatConversionException is thrown at runtime 



Strings are immutable, therefore no change at line: svar.replace(svar,"convertibles"); 

Format String Syntax: 


The optional argument_index is a decimal integer indicating the position of the argument in 

the argument list. 

The first argument is referenced by "1$", the second by "2$", etc. 

The optional flags is a set of characters that modify the output format. The set of valid flags 

depends on theconversion. 

's', 'S' general 

'd' integral The result is formatted as a decimal / integer 

Q85. View the exhibit: 

Given the code fragment: 

What is the result? 

A. Compilation fails 

B. 6 

C. 4 

D. 1 

E. 3 

F. Not possible to answer due to missing exhibit. 



C: 4 Falls ge.ndert zu: return FileVisitResult.CONTINUEsonst A: weil CONTINUE als Konstante unbekannt Note: TheFileSystems.getDefault() returns the default FileSystem. The default file system creates objects thatprovide access to the file systems accessible to the Java virtual machine. The working directory of the filesystem is the current user directory, named by the system property user.dir. 

Q86. Given the code fragment: 

And a DOS-based file system: 

Which option, containing statement(s), inserted at line 3, creates the file and sets its attributes to hidden andread-only? 

A. DOSFileAttributes attrs = Files.setAttribute(file,"dos:hidden","dos: readonly") Files.createFile(file, attrs) 

B. Files.craeteFile(file); Files.setAttribute(file,"dos:hidden","dos:readonly"); 

C. Files.createFile(file,"dos:hidden","dos:readonly"); 

D. Files.createFile(file); Files.setAttribute(file,"dos:hidden", true); Files.setAttribute(file,"dos:readonly", true); 



You can set a DOS attribute using the setAttribute(Path, String, Object, LinkOption...) 

method, as 


Path file = ...; 

Files.setAttribute(file, "dos:hidden", true); 



public static Path setAttribute(Path path, 

String attribute, 

Object value, 

LinkOption... options) 

throws IOException 

Sets the value of a file attribute. 

Reference:Interface DosFileAttribute 

Q87. Given these facts about Java classes in an application: 


Class X is-a Class SuperX. 


Class SuperX has-a public reference to a Class Z. 


Class Y invokes public methods in Class Util. 


Class X uses public variables in Class Util. 

Which three statements are true? 

A. Class X has-a Class Z. 

B. Class Util has weak encapsulation. 

C. Class Y demonstrates high cohesion. 

D. Class X is loosely coupled to Class Util. 

E. Class SuperX's level of cohesion CANNOT be determined 

Answer: B,D,E 


B: Has class Util has both public methods and variables, it is an example of weak 


Note:Inheritance is also sometimes said to provide "weak encapsulation," because if you 

have code thatdirectly uses a subclass, such as Apple, that code can be broken by 

changes to a superclass, such as Fruit. 

One of the ways to look at inheritance is that it allows subclass code to reuse superclass 

code. For example, if 

Apple doesn't override a method defined in its superclass 

Fruit, Apple is in a sense reusing Fruit's implementation of the method. But Apple only 

"weakly encapsulates"the Fruit code it is reusing, because changes to Fruit's interface can 

break code that directly uses Apple. 


Note:Tight coupling is when a group of classes are highly dependent on one another. 

This scenario arises when a class assumes too many responsibilities, or when one concern 

is spread overmany classes rather than having its own class. 

Loose coupling is achieved by means of a design that promotes single-responsibility and 

separation ofconcerns. 

A loosely-coupled class can be consumed and tested independently of other (concrete) 


Interfaces are a powerful tool to use for decoupling. Classes can communicate through 

interfaces rather thanother concrete classes, and any class can be on the other end of that 

communication simply by implementingthe interface. 

E: Not enough information regarding SuperX' to determine the level of cohesion. 

Q88. Given the code fragment: What is the result when infected() is invoked? 

A. before try catch finally after 

B. before catch finally after 

C. before catch after 

D. before catch finally 

E. before catch 



The following line throws and exception: 

int i = 1/0; 

This exception is caught by: 

catch(Exception e) { 

System.out.print("catch "); 

throw e; 

Lastly, the finally statement is run as the finally block always executes when the try block 

exits. This ensuresthat the finally block is executed even if an unexpected exception 


Reference: Java Tutorial,The finally Block 

Q89. Given: 

What is the result of invoking Car's scop method? 

A. Both vehicles and Motorized's stop methods are invoked. 

B. Vehicles stop method is invoked. 

C. Motorized's stop method is invoked-

D. The implementation of the Car's stop determines the behavior. 

E. Compilation fails. 



The Car class is implementing the methods. Methods are not implemented in interfaces. 

Q90. Given: 

What is the result? 

A. Nice to see you,be fine 

B. Nice,see you,be fine 

C. Nice,see you, to, be fine 

D. Nice, see you, be fine 

E. Nice to see y, u, be fine 



The text ",to," is replaced by the ","