Tips to Pass 1Z0-804 Exam (11 to 20)

Realistic of 1Z0-804 free practice exam materials and torrent for Oracle certification for consumer, Real Success Guaranteed with Updated 1Z0-804 pdf dumps vce Materials. 100% PASS Java SE 7 Programmer II Exam exam Today!

Q11. Given a language code of fr and a country code of FR, which file name represents a resource bundle file namethat is not the default? 

A. MessageBundle_fr_FR.properties 

B. MessageBundle_fr_FR.profile 

C. MessageBundle_fr_FR.xinl 

D. MessageBundle__fr__FR.Java 

E. MessageBundle__fr__FR.Locale 

Answer:

Explanation: 

The default file is MessageBundle.properties. The non-default file name is 

MessageBundle_fr_FR.properties 

Note 0:.properties is a file extension for files mainly used in Java related technologies to 

store the configurableparameters of an application. They can also be used for storing 

strings for Internationalization and localization;these are known as Property Resource 

Bundles. Each parameter is stored as a pair of strings, one storing thename of the 

parameter (called the key), and the other storing the value.Note 1:You can obtain an 

instance of ResourceBundle by calling its static getBundle method.public static 

ResourceBundle getBundle(java.lang.String baseName) public static ResourceBundle 

getBundle(java.lang.String baseName, Locale locale) For example: 

ResourceBundle rb = ResourceBundle.getBundle("MyResources", Locale.US); This will 

load theResourceBundle object with the values in the corresponding properties file.1.If a 

suitable properties file is not found, the ResourceBundle object will use the default 

properties file, whichwill be the one whose name equals the base name and has the 

properties extension. In this case, the defaultfile would be MyResources.properties. 2.If this 

file is not found, a java.util.MissingResourceException will bethrown. 

Note2:java.util.ResourceBundle class enables you to choose and read the properties file 

specific to the user'slocale and look up the values. 

A ResourceBundle object has a base name. In order for a ResourceBundle object to pick 

up a properties file,the filename must be composed of the ResourceBundle base name, 

followed by an underscore, followed bythe language code, and optionally followed by 

another underscore and the country code. 

The format for the properties file name is as follows: 

basename_languageCode_countryCode 

For example, suppose the base name is MyResources and you define the following three 

locales: 

US-en DE-de CN-zh Then you would have these three properties files: MyResources_en_US.properties MyResources_de_DE.properties MyResources_zh_CN.properties 

Reference:Reading Properties Files using ResourceBundle 


Q12. Given: 

What is the result? 

A. Cue sports, Cue sports 

B. Compilation fails at line 9 

C. Compilation fails at line 11 

D. Compilation fails at line 12 

E. Compilation fails at line 13 

Answer:

Explanation: 

Class Snooker is public. Should be declared in a separate file. // Line 9 getCategory() >>> GetCategory() Line 13 


Q13. Which method would you supply to a class implementing the Callable interface? 

A. callable () 

B. executable () 

C. call () 

D. run () 

E. start () 

Answer:

Explanation: 

public interface Callable<V> 

A task that returns a result and may throw an exception. Implementors define a single 

method with noarguments called call. 

Note: 

Interface Callable<V> 

Type Parameters: 

V - the result type of method call 

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. 

The Executors class contains utility methods to convert from other common forms to 

Callable classes. 

Reference:java.util.concurrent 


Q14. Give: What is the likely result? 

A. The program produces the correct result, with similar performance to the original. 

B. The program produces the correct result, with performance degraded to the equivalent of being singlethreaded. 

C. The program produces an incorrect result. 

D. The program goes into an infinite loop. 

E. An exception is thrown at runtime. 

F. The program produces the correct result, with better performance than the original. 

Answer:

Explanation: 

join() does not proceed until the task's result has been computed. Here we start to wait beforedoing the computing. The code will not finish. 


Q15. Given: 

What is the result? 

A. false \sales\quarter\ . . \qtrlreport.txt 

B. false \quarter\ . . \qtrlreport.txt 

C. true . . \ . . \ . . \ annualreport.txt 

D. true \ . . \ . . \annualreport.txt 

Answer:

Explanation: 

( richtig !! import java.nio.file.Path; import java.nio.file.Paths; ) original-Aufgabe war ( falsch >> import java.io.file.Path; import java.io.file.Paths; ) The relativize method that can be used to construct a relative path between two paths. relativize Path relativize(Path other) Constructs a relative path between this path and a given path. Parameters:other - the path to relativize against this path Returns:the resulting relative path, or an empty path if both paths are equal Note: Relativization is the inverse of resolution. This method attempts to construct a relative path that when resolvedagainst this path, yields a path that locates the same file as the given path. For18example, on UNIX, if this path is "/a/b" and the given path is "/a/b/c/d" then the resulting relative path would be"c/d". Where this path and the given path do not have a root component, then a relative path can beconstructed. A relative path cannot be constructed if only one of the paths have a root component. Where bothpaths have a root component then it is implementation dependent if a relative path can be constructed. If thispath and the given path are equal then an empty path is returned. For any two normalized paths p and q, where q does not have a root component,p.relativize(p.resolve(q)).equals(q) When symbolic links are supported, then whether the resulting path, when resolved against this path, yields apath that can be used to locate the same file as other is implementation dependent. For example, if this path is"/a/b" and the given path is "/a/x" then the resulting relative path may be "../x". If "b" is a symbolic link then isimplementation dependent if "a/b/../x" would locate the same file as "/a/x". 


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


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


Q18. Given: What is the result? 

A. woof arf 

B. woof woof 

C. arf arf 

D. A RuntimeException is generated 

E. The code fails to compile 

Answer:

Explanation: 

class Dog { 

protected String bark() 

public class Beagle extends Dog { 

private String bark() 

Cannot reduce the visibility of the inherited method from Dog 


Q19. Given: 

Which two statements, inserted independently at line ***, enable the program to produce the following output: 

We have 002 Blue pants that cost $24.99. 

A. System.out.printf("We have %03d %s pants that cost $%3.2f.\n",quantity, color, price); 

B. System.out.printf("We have$03d$s pants that cost $$3.2f.\n",quantity, color, price); 

C. String out = String.format ("We have %03d %s pants that cost $%3.2f.\n",quantity, 

color,price); 

System.out.println(out); 

D. String out = System.out.format("We have %03d %s pants that cost $%3.2f.",quantity, 

color, price); 

System.out.println(out); 

E. System.out.format("We have %s%spants that cost $%s.\n",quantity, color, price); 

Answer: A,C 


Q20. Given: Which statement is true? 

A. SportsCar must implement methods from TurboVehicle and steerable 

B. SportsCar must override methods defined by car. 

C. SportsCar must implement methods define by convertible. 

D. Instances of car can invoke convertible methods. 

Answer:

Explanation: 

To declare a class that implements an interface, you include an implements clause in the classdeclaration. By convention, the implements clause follows the extends clause, if there is one. Here are the some point that must be considered while implementing an interface (or interfaces) into a javaclass. A class implementing an interface must either implement all the methods of that interface otherwise known asthe abstract class. A class in java may extend at most one superclass because java does not allow multiple inheritance, by it mayimplement more than one interface. Multiple inheritance in java is achieved through the interfaces. When aclass implements more than one interface then implement statement requires a comma- separated list ofinterfaces to be implement by that class.