Oracle 1z0-804 Exam Practice Questions (P. 1)
- Full Access (150 questions)
- Six months of Premium Access
- Access to one million comments
- Seamless ChatGPT Integration
- Ability to download PDF files
- Anki Flashcard files for revision
- No Captcha & No AdSense
- Advanced Exam Configuration
Question #1
Given:

Which three values will appear in the output?

Which three values will appear in the output?
- A5
- B7
- Ca1
- Da2
- Eb1
- Fb2 ADE
Correct Answer:
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;
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;
send
light_mode
delete
Question #2
Given:

What is the result?

What is the result?
- Afalse false
- Btrue false
- Ctrue true
- DCompilation fails
- EAn exception is thrown at runtime
Correct Answer:
A
(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) { if (obj != null){
Product p = (Product)obj;
return this.id == p.id;
}
return false;
}
A
(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) { if (obj != null){
Product p = (Product)obj;
return this.id == p.id;
}
return false;
}
send
light_mode
delete
Question #3
Given:

What is the result?

What is the result?
- Atolting cantering tolting
- Bcantering cantering cantering
- Ccompilation fails
- Dan exception is thrown at runtime
Correct Answer:
C
Compiler says: Cannot reduce the visibility of the inherited method from Rideable. mssen 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
C
Compiler says: Cannot reduce the visibility of the inherited method from Rideable. mssen 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
send
light_mode
delete
Question #4
Which four are syntactically correct?
- Apackage abc; package def; import Java.util . * ; public class Test { }
- Bpackage abc; import Java.util.*; import Java.util.regex.* ; public class Test { }
- Cpackage abc; public class Test {} import Java.util.* ;
- Dimport Java.util.*; package abc; public class Test {}
- Epackage abc; import java.util. *; public class Test{}
- Fpublic class Test{} package abc; import java.util.*{}
- Gimport java.util.*; public class Test{}
- Hpackage abc; public class test {}
Correct Answer:
BEGH
BEGH
send
light_mode
delete
Question #5
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?
- 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?
- AType y must be an interface.
- BType x must be an abstract class.
- CType y must be an abstract class.
- DType x could implement or extend from Type y.
- EType x could be an abstract class or an interface.
- FType y could be an abstract class or an interface.
Correct Answer:
BDF
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.
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)
BDF
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.
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)
send
light_mode
delete
All Pages