1z0 804 PDF
1z0 804 PDF
1z0 804 PDF
Java SE 7 Programmer II
Java8 1z0-804 Dumps Available Here at:
https://www.certification-questions.com/java8-dumps/1Z0-804-dumps.html
Enrolling now you will get access to 150 questions in a unique set of 1z0-
804 dumps
Question 1
Given:
Options:
A. 5
https://www.certification-questions.com
Java8 1z0-804
B. 7
C. a1
D. a2
E. b1
F. b2
Answer: A, D, E
Explanation:
Static method of base class is invoked >>
A myA = new B();
System.out.print(myA.doA() + myA.doA2() + myA.a);
class B String doA() { return "b1 "; }
class A protected static String doA2 () { return "a2 "; }
class B int a = 7;
Question 2
Given:
https://www.certification-questions.com
Java8 1z0-804
Options:
A. false false
B. true false
C. true true
D. Compilation fails
Answer: A
Explanation:
(this == obj) is the object implementation of equals() and therefore FALSE, if the reference points to
various objects and then the super.equals() is invoked, the object method equals() what still result in
FALSE better override of equals() is to compare the attributes like:
public boolean equals (Object obj) {
https://www.certification-questions.com
Java8 1z0-804
if (obj != null){
Product p = (Product)obj;
return this.id == p.id;
}
return false;
}
Question 3
Given:
Options:
https://www.certification-questions.com
Java8 1z0-804
C. compilation fails
Answer: C
Explanation:
Compiler says: Cannot reduce the visibility of the inherited method from Rideable. müssen PUBLIC sein
public String ride() { return "cantering "; }
public String ride() { return "tolting "; }
if this is given then the result would be:
A : tolting cantering tolting
Question 4
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?
Options:
Answer: B, D, F
Explanation:
Unlike interfaces, abstract classes can contain fields that are not static and final, and they can contain
implemented methods. Such abstract classes are similar to interfaces, except that they provide a partial
implementation, leaving it to subclasses to complete the implementation. If an abstract class contains only
abstract 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
the generic sense of the term) that classes must implement. Interfaces are declared using the interface
keyword, and may only contain method signature and constant declarations (variable declarations that are
declared to be both static and final). An interface may never contain method definitions.
https://www.certification-questions.com
Java8 1z0-804
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
is declared without an implementation (without braces, and followed by a semicolon)
Question 5
Given:
What two changes, made independently, will enable the code to compile?
Options:
Answer: B, D
Explanation:
Compiler say:
- Der Typ CheckingAccount muss die übernommene abstrakte
Methode Account.deposit(double) implementieren
- Der Typ CheckingAccount muss die übernommene abstrakte
Methode Account.withdraw(double) implementieren
ODER
Typ CheckingAccount als abstract definieren
https://www.certification-questions.com
Java8 1z0-804
Question 6
Which two forms of abstraction can a programmer use in Java?
Options:
A. enums
B. interfaces
C. primitives
D. abstract classes
E. concrete classes
F. primitive wrappers
Answer: B, D
Explanation:
When To Use Interfaces
An interface allows somebody to start from scratch to implement your interface or implement your interface
in some other code whose original or primary purpose was quite different from your interface. To them,
your interface is only incidental, something that have to add on to the their code to be able to use your
package. The disadvantage is every method in the interface must be public. You might not want to expose
everything.
*When To Use Abstract classes
An abstract class, in contrast, provides more structure. It usually defines some default implementations
and provides some tools useful for a full implementation. The catch is, code using it must use your class as
the base. That may be highly inconvenient if the other programmers wanting to use your package have
already developed their own class hierarchy independently. In Java, a class can inherit from only one base
class. *When to Use Both
You can offer the best of both worlds, an interface and an abstract class. Implementors can ignore your
abstract class if they choose. The only drawback of doing that is calling methods via their interface name is
slightly slower than calling them via their abstract class name.
Reference: http://mindprod.com/jgloss/interfacevsabstract.html
Question 7
Given:
https://www.certification-questions.com
Java8 1z0-804
Options:
A. Up Down
B. Up Up
C. Up null
D. Compilation fails
Answer: D
Explanation:
------
Exception in thread "main" java.lang.ExceptionInInitializerError at garden.Garden.main
Caused by: java.lang.RuntimeException: Uncompilable source code - garden.Plant is not abstract and
does not override abstract method growthDirection() in garden.Plant
Question 8
Which four are syntactically correct?
Options:
A. package abc;
https://www.certification-questions.com
Java8 1z0-804
package def;
import Java.util . * ;
public class Test { }
B. package abc;
import Java.util.*;
import Java.util.regex.* ;
public class Test { }
C. package abc;
D. import Java.util.*;
package abc;
public class Test {}
E. package abc;
import java.util. *;
public class Test{}
package abc;
import java.util.*{}
G. import java.util.*;
H. package abc;
Answer: B, E, G, H
Question 9
Given:
https://www.certification-questions.com
Java8 1z0-804
Which fragment, inserted in the Books interface, enables the code to compile?
Options:
Answer: D
Question 10
Given:
https://www.certification-questions.com
Java8 1z0-804
Options:
A. Event Quiz
B. Event Event
C. Quiz Quiz
D. Quiz Event
E. Compilation fails
Answer: E
Would you like to see more? Don't miss our 1z0-804 PDF
file at:
https://www.certification-questions.com/java8-dumps-pdf-download/1Z0-804-pdf.html
https://www.certification-questions.com