[Free] 2018(Jan) EnsurePass Examcollection Oracle 1z0-804 Dumps with VCE and PDF 1-10

Ensurepass.com : Ensure you pass the IT Exams
2018 Jan Oracle Official New Released 1z0-804
100% Free Download! 100% Pass Guaranteed!
http://www.EnsurePass.com/1z0-804.html

Java SE 7 Programmer II

Question No: 1

Given:

Ensurepass 2018 PDF and VCE

Which three values will appear in the output?

  1. 5

  2. 7

  3. a1

  4. a2

  5. b1

  6. b2

Answer: A,D,E Explanation:

Staticmethod of base class is invoked gt;gt; A myA = new B();

System.out.print(myA.doA() myA.doA2() myA.a); class B String doA() { return quot;b1 quot;; }

class A protected static String doA2 () { return quot;a2 quot;; } class B int a = 7;

Question No: 2

Given:

Ensurepass 2018 PDF and VCE

What is the result?

  1. false false

  2. true false

  3. true true

  4. Compilation fails

  5. An exception is thrown at runtime

Answer: A Explanation:

(this == obj) is the object implementation of equals() and therefore FALSE, if the reference points to variousobjectsand then the super.equals() is invoked, the object method equals() what still result in FALSEbetter 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;

}

Question No: 3

Given:

Ensurepass 2018 PDF and VCE

What is the result?

  1. tolting cantering tolting

  2. cantering cantering cantering

  3. compilation fails

  4. an exception is thrown at runtime

Answer: C Explanation:

Compiler says: Cannot reduce the visibility of the inherited method from Rideable. m眉ssen PUBLIC sein

public String ride() { return quot;cantering quot;; } public String ride() { return quot;tolting quot;; }

if this is given then the result would be: A : tolting cantering tolting

Question No: 4

Which four are syntactically correct?

  1. package abc; package def; import Java.util . * ; public class Test { }

  2. package abc; import Java.util.*;

    import Java.util.regex.* ; public class Test { }

  3. package abc; public class Test {} import Java.util.* ;

  4. import Java.util.*; package abc;

    public class Test {}

  5. package abc; import java.util. *; public class Test{}

  6. public class Test{} package abc;

    import java.util.*{}

  7. import java.util.*; public class Test{}

  8. package abc; public class test {}

Answer: B,E,G,H

Question No: 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?

    1. Type y must be an interface.

    2. Type x must be an abstract class.

    3. Type y must be an abstract class.

    4. Type x could implement or extend from Type y.

    5. Type x could be an abstract class or an interface.

    6. 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)

    Question No: 6

    Given:

    Ensurepass 2018 PDF and VCE

    What two changes, made independently, will enable the code to compile?

    1. Change the signature of Account to: public class Account.

    2. Change the signature of CheckingAccount to: public abstract CheckingAccount

    3. Implement private methods for deposit and withdraw in CheckingAccount.

    4. Implement public methods for deposit and withdraw in CheckingAccount.

    5. Change Signature of checkingAccount to: CheckingAccount implements Account.

    6. Make Account an interface.

    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

Question No: 7

Given:

Ensurepass 2018 PDF and VCE

Which fragment, inserted in the Books interface, enables the code to compile?

  1. public abstract String type; public abstract String getType();

  2. public static String type; public abstract String getType();

  3. public String type = quot;Fictionquot;; public static String getType();

  4. public String type = quot;Fictionquot;; public abstract String getType();

Answer: D

Question No: 8

Given:

Ensurepass 2018 PDF and VCE

What is the result?

  1. Event Quiz

  2. Event Event

  3. Quiz Quiz

  4. Quiz Event

  5. Compilation fails

Answer: E

Question No: 9

Which two forms of abstraction can a programmer use in Java?

  1. enums

  2. interfaces

  3. primitives

  4. abstract classes

  5. concrete classes

  6. 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 insome other code whose original or primary purpose was quite different from your interface. To them, yourinterface is only incidental, something that have to add on to thetheir code to be able to use your package. Thedisadvantage 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 andprovides some tools useful for a full implementation. The catch is, code using it must use your class as thebase. That may be highly inconvenient if the other programmers wanting to use your package have alreadydeveloped 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 yourabstract class if they choose. The only drawback of doing that is calling methods via their interface name isslightly slower than calling them via their abstract class name.

Reference:http://mindprod.com/jgloss/interfacevsabstract.html

Question No: 10

Given:

Ensurepass 2018 PDF and VCE

What is the result?

  1. Up Down

  2. Up Up

  3. Up null

  4. Compilation fails

  5. An exception is thrown at runtime

Answer: D Explanation:

Exception in thread quot;mainquot; java.lang.ExceptionInInitializerError at garden.Garden.main Caused by: java.lang.RuntimeException: Uncompilable source code – garden.Plant is not abstract and doesnot override abstract method growthDirection() in garden.Plant

100% Ensurepass Free Download!
Download Free Demo:1z0-804 Demo PDF
100% Ensurepass Free Guaranteed!
Download 2018 EnsurePass 1z0-804 Full Exam PDF and VCE

EnsurePass ExamCollection Testking
Lowest Price Guarantee Yes No No
Up-to-Dated Yes No No
Real Questions Yes No No
Explanation Yes No No
PDF VCE Yes No No
Free VCE Simulator Yes No No
Instant Download Yes No No

Leave a Comment

(0 Comments)

Your email address will not be published. Required fields are marked *