Proper study guides for Abreast of the times Oracle Java SE 8 Programmer I certified begins with Oracle 1z0-808 preparation products which designed to deliver the Accurate 1z0-808 questions by making you pass the 1z0-808 test at your first time. Try the free 1z0-808 demo right now.
♥♥ 2021 NEW RECOMMEND ♥♥
Free VCE & PDF File for Oracle 1z0-808 Real Exam (Full Version!)
★ Pass on Your First TRY ★ 100% Money Back Guarantee ★ Realistic Practice Exam Questions
Free Instant Download NEW 1z0-808 Exam Dumps (PDF & VCE):
Available on:
http://www.surepassexam.com/1z0-808-exam-dumps.html
2021 Apr 1z0-808 free draindumps
Q121. 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
Answer: A
Q122. Given the code fragment:
public static void main(String[] args) {
int iArray[] = {65, 68, 69};
iArray[2] = iArray[0];
iArray[0] = iArray[1];
iArray[1] = iArray[2];
for (int element : iArray) {
System.out.print(element + " ");
}
A. 68, 65, 69
B. 68, 65, 65
C. 65, 68, 65
D. 65, 68, 69
E. Compilation fails
Answer: B
Q123. Which two are benefits of polymorphism?
A. Faster code at runtime
B. More efficient code at runtime
C. More dynamic code at runtime
D. More flexible and reusable code
E. Code that is protected from extension by other classes
Answer: C,D
Q124. Given:
The class is poorly encapsulated. You need to change the circle class to compute and return the area instead.
Which two modifications are necessary to ensure that the class is being properly encapsulated?
A. Remove the area field.
B. Change the getArea( ) method as follows:
public double getArea ( ) { return Match.PI * radius * radius; }
C. Add the following method:
public double getArea ( ) {area = Match.PI * radius * radius; }
D. Change the cacess modifier of the SerRadius ( ) method to be protected.
Answer: B,D
Q125. Which three statements are true about the structure of a Java class?
A. A class can have only one private constructor.
B. A method can have the same name as a field.
C. A class can have overloaded static methods.
D. A public class must have a main method.
E. The methods are mandatory components of a class.
F. The fields need not be initialized before use.
Answer: A,B,C
Explanation: A: Private constructors prevent a class from being explicitly instantiated by its
callers.
If the programmer does not provide a constructor for a class, then the system will always
provide a default, public no-argument constructor. To disable this default constructor,
simply add a private no-argument constructor to the class. This private constructor may be
empty.
B: The following works fine:
int cake() {
int cake=0;
return (1);
}
C: We can overload static method in Java. In terms of method overloading static method
are just like normal methods and in order to overload static method you need to provide
another static method with same name but different method signature.
Incorrect:
Not D: Only a public class in an application need to have a main method.
Not E:
Example:
class A
{
public string something;
public int a;
}
Q: What do you call classes without methods? Most of the time: An anti pattern.
Why? Because it faciliates procedural programming with "Operator" classes and data
structures. You separate data and behaviour which isn't exactly good OOP.
Often times: A DTO (Data Transfer Object)
Read only datastructures meant to exchange data, derived from a business/domain object.
Sometimes: Just data structure.
Well sometimes, you just gotta have those structures to hold data that is just plain and
simple and has no operations on it.
Not F: Fields need to be initialtized. If not the code will not compile.
Example:
Uncompilable source code - variable x might not have been initialized
Rebirth 1z0-808 exam answers:
Q126. Consider following interface.
Which of the following will create instance of Runnable type?
A. Runnable run = 0 -> {System.out.println("Run");}
B. Runnable run = 0 -> System.outprintlnfRun");
C. Runnable run = 0 > System.outprintlnfRun");
D. Runnable run = > System.ouLprintlnfRun"};
E. None of the above.
Answer: A
Explanation:
Option A is the correct answer.
To create we have used following method with LocalDate class;
public static LocalDate of(intyear, int month, intdayOfMonth)
Here we need to remember that month is not zero based so if you pass 1 for month, then
month will be January.
Then we have used period object of 1 day and add to date object which makes current date
to next day, so final output is 2015-03-27. Hence option A is correct.
Q127. Which three statements are benefits of encapsulation?
A. Allows a class implementation to change without changing t he clients
B. Protects confidential data from leaking out of the objects
C. Prevents code from causing exceptions
D. Enables the class implementation to protect its invariants
E. Permits classes to be combined into the same package
F. Enables multiple instances of the same class to be created safely
Answer: A,B,D
Q128. Given the code fragment:
What is the result?
A. 20
B. 25
C. 29
D. Compilation fails
E. AnArrayIndexOutOfBoundsException is thrown at runtime
Answer: A
Q129. Given the content of three files:
Which statement is true? Which statement is true?
A. Only the A.Java file compiles successfully.
B. Only the B.java file compiles successfully.
C. Only the C.java file compiles successfully.
D. The A.Java and B.java files compile successfully.
E. The B.java and C.java files compile successfully.
F. The A.Java and C.java files compile successfully.
Answer: A
Explanation: In class B.Java doStuff() has access modifier with variable name which is not allowed. C.Java class name is different than file name. Only private classes can have different names than file names
Q130. Given:
What is the result?
A. The program prints nothing
B. d
C. A StringIndexOutOfBoundsException is thrown at runtime.
D. AnArrayIndexOutOfBoundsException is thrown at runtime.
E. A NullPointerException is thrown at runtime.
Answer: C
