Pass4sure 1Z0-804 Questions are updated and all 1Z0-804 answers are verified by experts. Once you have completely prepared with our 1Z0-804 exam prep kits you will be ready for the real 1Z0-804 exam without a problem. We have Avant-garde Oracle 1Z0-804 dumps study guide. PASSED 1Z0-804 First attempt! Here What I Did.
♥♥ 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
Q1. Given these facts about Java types in an application:
-
Type x is a template for other types in the application.
-
Type x implements dostuff ().
-
Type x declares, but does NOT implement doit().
-
Type y declares doOther() .
Which three are true?
A. Type y must be an interface.
B. Type x must be an abstract class.
C. Type y must be an abstract class.
D. Type x could implement or extend from Type y.
E. Type x could be an abstract class or an interface.
F. Type y could be an abstract class or an interface.
Answer: B,D,F
Explanation:
Unlike interfaces, abstract classes can contain fields that are not static and final, and they can containimplemented methods. Such abstract classes are similar to interfaces, except that they provide a partialimplementation, leaving it to subclasses to complete the implementation. If an abstract class contains onlyabstract method declarations, it should be declared as an interface instead.
Note: An interface in the Java programming language is an abstract type that is used to specify an interface (in thegeneric sense of the term) that classes must implement. Interfaces are declaredusing the interface keyword,and may only contain method signature and constant declarations (variable declarations that are declared tobe both static and final). An interface maynever contain method definitions.
Note 2: an abstract class is a class that is declared abstract--it may or may not include abstract methods.Abstract classes cannot be instantiated, but they can be subclassed. An abstract method is a method that isdeclared without an implementation (without braces, and followed by a semicolon)
Q2. Given: What is the result?
A. Null
B. class java.lang.ArraylndexOutOfBoundsException
C. class java.lang.NullPointerException
D. class java.lang.Exception
E. Compilation fails.
Answer: E
Explanation:
error: incompatible types e = new Exception(); required: RuntimeException found: Exception
Q3. Given the code fragment:
What is the result?
A. Java 7
B. Java 6
C. Java 7, Java 6
D. Java 7 java 6
E. Java
Answer: C
Explanation:
regex: Java / one or more anything !!! / ends with a digit so it is the source string
Q4. Which type of ExecutorService supports the execution of tasks after a fixed delay?
A. DelayedExecutorService
B. ScheduledExecutorService
C. TimedExecutorService D. FixedExecutorService
E. FutureExecutorService
Answer: B
Explanation:
The ScheduledExecutorService interface supplements the methods of its parent
ExecutorService withschedule, which executes a Runnable or Callable task after a
specified delay. In addition, the interface definesscheduleAtFixedRate and
scheduleWithFixedDelay, which executes specified tasks repeatedly, at definedintervals.
Note:The java.util.concurrent package defines three executor interfaces:
*Executor, a simple interface that supports launching new tasks. *ExecutorService, a
subinterface of Executor,which adds features that help manage the lifecycle, both of the
individual tasks and of the executor itself.
*ScheduledExecutorService, a subinterface of ExecutorService, supports future and/or
periodic execution oftasks.
Reference: The Java Tutorials,Executor Interfaces
Q5. Given:
And the commands: javac Counter.java java ea Counter
What is the result?
A. 2
B. 3
C. NullPointException is thrown at runtime
D. AssertionError is thrown at runtime
E. Compilation fails
Answer: B
Explanation:
The command line javac Counter.java
Willcompile the code.
The command line java ea Counter
Willrun the cod with assertions enabled.
Assertion is true because getCount(arr) = 3 and Length of array is 4
The following line:
assert (getCount(arr) < arr.length);
where the Boolean expression getCount(arr) < arr.length will evaluate to false, will ensure
that anAssertionError is thrown at runtime.
Note:The javac command compiles Java source code into Java bytecodes. You then use
the Java interpreter -the java command - to interprete the Java bytecodes.
Note 2:The java tool launches a Java application. It does this by starting a Java runtime
environment, loading aspecified class, and invoking that class's main method. The method
declaration must look like the following:public static void main(String args[])
Paramater ea:
-enableassertions[:<package name>"..." | :<class name> ] -ea[:<package name>"..." |
:<class name> ]
Enable assertions. Assertions are disabled by default. With no arguments,
enableassertions or -ea enablesassertions.
Note 3:
An assertion is a statement in the JavaTM programming language that enables you to test
your assumptionsabout your program.
Each assertion contains a boolean expression that you believe will be true when the
assertion executes. If it isnot true, the system will throw an error.
Q6. Given:
String s = new String("3");
System.out.print(1 + 2 + s + 4 + 5);
What is the result?
A. 12345
B. 3345
C. 1239
D. 339
E. Compilation fails.
Answer: B
Explanation:
1 and 2 are added.
Then the string s is concatenated.
Finally 3 and 4 are concatenated as strings.
Q7. Given:
What is the result?
A. fast slow
B. fast goes
C. goes goes
D. fast fast
E. fast followed by an exception
F. Compilation fails
Answer: F
Explanation:
Line:Vehicle v = new Sportscar();
causes compilation failure:
error: cannot find symbol
Vehicle v = new Sportscar();
symbol: class Sportscar
location: class VehicleTest
Q8. Which is a key aspect of composition?
A. Using inheritance
B. Method delegation
C. Creating abstract classes
D. Implementing the composite interface
Answer: B
Explanation:
In the composition approach, the subclass becomes the "front-end class," and the superclass becomes the"back-end class." With inheritance, a subclass automatically inherits an implemenation of any non-privatesuperclass method that it doesn't override. With composition, by contrast, the front-end class must explicitlyinvoke a corresponding method in the back-end class from its own implementation of the method. This explicitcall is sometimes called "forwarding" or "delegating" the method invocation to the back-end object.Note: Composition means the same as:
*
contains
*
is part of Note 2: As you progress in an object-oriented design, you will likely encounter objects in the problem domainthat contain other objects. In this situation you will be drawn to modeling a similar arrangement in the design ofyour solution. In an object-oriented design of a Java program, the way in which you model objects that containother objects is with composition, the act of composing a class out of references to other objects. Withcomposition, references to the constituent objects become fields of the containing object. To use compositionin Java, you use instance variables of one object to hold references to other objects.
Q9. What will the following class print when run?
A. javajava
B. lavajava
C. javajavac
D. lavajavac
E. None of these.
Answer: C
Q10. Given the two Java classes:
Which two code snippets, added independently at line ***, can make the Buzzword class compile?
A. this ();
B. this (100);
C. this ("Buzzword");
D. super ();
E. super (100);
F. super ("Buzzword");
Answer: C,F