10 Tips For 1Z0-804 consumer

we provide 100% Guarantee Oracle 1Z0-804 rapidshare 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

Q51. Given: 

What is the result? 

A. John-.-George-.-Paul-.-Ringo 

B. John George Paul Ringo 

C. John -George -Paul -Ringo -

D. An exception is thrown at runtime 

E. Compilation fails 

Answer:

Explanation: 

The split() method is used to split a string into an array of substrings, and returns the new array. regex: - followed by two characters 


Q52. Given the code fragment: 

DateFormat df; 

Which statement defines a new Dateformat object that displays the default date format for the UK Locale? 

A. df = DateFormat.getDateInstance (DateFormat.DEFAULT, Locale (UK)); 

B. df = DateFormat.getDateInstance (DateFormat.DEFAULT, UK); 

C. df = DateFormat.getDateInstance (DateFormat.DEFAULT, Locale.UK); 

D. df = new DateFormat.getDateInstance (DateFormat.DEFAULT, Locale.UK); 

E. df = new DateFormat.getDateInstance (DateFormat.DEFAULT, Locale (UK)); 

Answer:

Explanation: 

The UK locale is constructed withLocale.UK. 

To format a date for a different Locale, specify it in the call to getDateInstance(). 

DateFormat df = 

DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE); 

Note: getDateInstance( int style, Locale aLocale ) 

Gets the date formatter with the given formatting style for the given locale. 

Reference:Class DateFormat 


Q53. Given the code fragment: 

Assume that the SQL queries return records. What is the result of compiling and executing this code fragment? 

A. The program prints employee IDs 

B. The program prints customer IDs 

C. The program prints Error 

D. Compilation fails on line *** 

Answer:

Explanation: 

!!! The given Code prints Error -- the second query clears the ResultSet !? ErrorMessage: Operation notallowed after ResultSet closed 

It would print A, if second Query i set to rs = stmt.executeQuery("SELECT ID FROM Customer"); // Line *** It would print B, if Line *** is missing. // The program compiles and runs fine. Both executeQuery statements will run. The first executeQuery statement (ResultSet rs = stmt.executeQuery(query);) will set the rs Resultset. It will be used in the while loop. EmployIDswill be printed. Note: Executes the given SQL statement, which returns a single ResultSet object. Parameters:sql - an SQL statement to be sent to the database, typically a static SQL SELECT statement Returns:a ResultSet object that contains the data produced by the given query; never null 


Q54. Given: 

What is the result? 

A. Compilation fails. 

B. 78class java.lang.Array.IndexOutOfBoundException 

C. class MarkOutOfBoundException 

D. class java.lang.arrayIndexOutOfBoundException 

Answer:

Explanation: 

The exception MarkOutOfBoundsException is already caught by the alternative ArrayIndexOutOfBoundsException 


Q55. 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 

Answer:

Explanation: 

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


Q56. Given the code fragment: 

What is the result when the result.txt file already exists in c:student? 

A. The program replaces the file contents and the file's attributes and prints Equal. 

B. The program replaces the file contents as well as the file attributes and prints Not equal. 

C. An UnsupportedOperationException is thrown at runtime. 

D. The program replaces only the file attributes and prints Not equal. 

Answer:

Explanation: 

Assuming there is a file D:\faculty\report.txt then this file will be copied and will be replacing C:\student\report.txt. 


Q57. A valid reason to declare a class as abstract is to: 

A. define methods within a parent class, which may not be overridden in a child class 

B. define common method signatures in a class, while forcing child classes to contain unique methodimplementations 

C. prevent instance variables from being accessed 

D. prevent a class from being extended 

E. define a class that prevents variable state from being stored when object Instances are serialized 

F. define a class with methods that cannot be concurrently called by multiple threads 

Answer:

Explanation: 

Note:An abstract method in Java is something like a pure virtual function in C++ (i.e., a virtualfunction that is declared = 0). In C++, a class that contains a pure virtual function is called an abstract classand cannot be instantiated. The same is true of Java classes that contain abstract methods. Any class with an abstract method is automatically abstract itself and must be declared as such. An abstract class cannot be instantiated. A subclass of an abstract class can be instantiated only if it overrides each of the abstract methods of itssuperclass and provides an implementation (i.e., a method body) for all of them. Such a class is often called aconcrete subclass, to emphasize the fact that it is not abstract. If a subclass of an abstract class does not implement all the abstract methods it inherits, that subclass is itselfabstract.static, private, and final methods cannot be abstract, since these types of methods cannot be overridden by asubclass. Similarly, a final class cannot contain any abstract methods. A class can be declared abstract even if it does not actually have any abstract methods. Declaring such a classabstract indicates that the implementation is somehow incomplete and is meant to serve as a superclass forone or more subclasses that will complete the implementation. Such a class cannot be instantiated. 


Q58. What are two differences between Callable and Runnable? 

A. A Callable can return a value when executing, but a Runnable cannot. 

B. A Callable can be executed by a ExecutorService, but a Runnable cannot. 

C. A Callable can be passed to a Thread, but a Runnable cannot. 

D. A Callable can throw an Exception when executing, but a Runnable cannot. 

Answer: A,D 

Explanation: 

The Callable interface is similar to Runnable, in that both are designed for classes whose instances arepotentially executed by another thread. A Runnable, however, does not return a result and cannot throw achecked exception. 


Q59. Which two demonstrate the valid usage of the keyword synchronized? 

A. interface ThreadSafe { 

synchronized void doIt(); 

B. abstract class ThreadSafe { 

synchronized abstract void doIt(); 

C. class ThreadSafe { 

synchronized static void soIt () {} 

D. enum ThreadSafe { 

ONE, TWO, Three; 

synchronized final void doIt () {} 

Answer:

Explanation: 

The Java programming language provides two basic synchronization idioms: 

synchronized methods and synchronized statements. 

To make a method synchronized, simply add the synchronized keyword to its declaration. 


Q60. Which two properly implement a Singleton pattern? 

A. class Singleton { 

private static Singleton instance; 

private Singleton () {} 

public static synchronized Singleton getInstance() { 

if (instance == null) { 

instance = new Singleton (); 

return instance; 

B. class Singleton { 

private static Singleton instance = new Singleton(); 

protected Singleton () {} 

public static Singleton getInstance () { 

return instance; 

C. class Singleton { 

Singleton () {} 

private static class SingletonHolder { 

private static final Singleton INSTANCE = new Singleton (); 

public static Singleton getInstance () { 

return SingletonHolder.INSTANCE; 

D. enum Singleton { 

INSTANCE; 

Answer: A,D 

Explanation: 

A: Here the method for getting the reference to the SingleTon object is correct. 

B: The constructor should be private 

C: The constructor should be private 

Note: Java has several design patterns Singleton Pattern being the most commonly used. 

Java Singletonpattern belongs to the family of design patterns, that govern the instantiation process. This design patternproposes that at any time there can only be one instance of a singleton (object) created by the JVM. 

The class's default constructor is made private, which prevents the direct instantiation of the object by others(Other Classes). A static modifier is applied to the instance method that returns the object as it then makes thismethod a class level method that can be accessed without creating an object. OPTION A == SHOW THE LAZY initialization WITHOUT DOUBLE CHECKED LOCKING TECHNIQUE ,BUT ITS CORRECT OPTION D == Serialzation and thraead-safety guaranteed and with couple of line of code enum Singletonpattern is best way to create Singleton in Java 5 world. AND THERE ARE 5 WAY TO CREATE SINGLETON CLASS IN JAVA 1>>LAZY LOADING (initialization) USING SYCHRONIZATION 2>>CLASS LOADING (initialization) USINGprivate static final Singleton instance = new Singleton(); 3>>USING ENUM 4>>USING STATIC NESTED CLASS 5>>USING STATIC BLOCK AND MAKE CONSTRUCTOR PRIVATE IN ALL 5 WAY.