Ensurepass.com : Ensure you pass the IT Exams
2018 Jan Oracle Official New Released 1z0-853
100% Free Download! 100% Pass Guaranteed!
http://www.EnsurePass.com/1z0-853.html
Java Standard Edition 5 Programmer Certified Professional Exam
Question No: 161 – (Topic 2)
Given:
-
public abstract class Shape {
-
int x;
-
int y;
-
public abstract void draw();
-
public void setAnchor(int x, int y) {
-
this.x = x;
-
this.y = y;
18. }
19. }
and a class Circle that extends and fully implements the Shape class. Which is correct?
-
Shape s = new Circle();
-
setAnchor(10,10);
-
draw();
-
Circle c = new Circle();
-
Shape.setAnchor(10,10);
-
Shape.draw();
-
Circle c = new Shape();
-
setAnchor(10,10);
-
draw();
-
Shape s = new Shape();
-
setAnchor(10,10);
-
draw();
-
Shape s = new Circle(); s-gt;setAnchor(10,10);
s-gt;draw();
Answer: A
Question No: 162 – (Topic 2)
Given:
enum Example { ONE, TWO, THREE } Which statement is true?
-
The Example values can be used in a java.util.SortedSet, but the set will NOT be sorted because enumerated types do NOT implement java.lang.Comparable.
-
The expressions (ONE == ONE) and ONE.equals(ONE) are both guaranteed to be true.
-
The Example values cannot be used in a raw java.util.HashMap; instead, the programmer must use a java.util.EnumMap.
-
The expression (ONE lt; TWO) is guaranteed to be true and ONE.compareTo(TWO) is guaranteed to be less than one.
Answer: B
Question No: 163 – (Topic 2)
Given:
-
public class Person {
-
private String name;
-
public Person(String name) { this.name = name; }
-
public boolean equals(Person p) {
-
return p.name.equals(this.name); 6. }
7. }
Which statement is true?
-
When adding Person objects to a java.util.Set collection, the equals method in line 4 will prevent duplicates.
-
Compilation fails because the private attribute p.name cannot be accessed in line 5.
-
The equals method does NOT properly override the Object.equals method.
-
To work correctly with hash-based data structures, this class must also implement the hashCode method.
Answer: C
Question No: 164 – (Topic 2)
Given a correctly compiled class whose source code is:
-
package com.sun.sjcp;
-
public class Commander {
-
public static void main(String[] args) {
-
// more code here 5. }
6. }
Assume that the class file is located in /foo/com/sun/sjcp/, the current directory is /foo/, and that the classpath contains quot;.quot; (current directory).
Which command line correctly runs Commander?
-
java Commander
-
java com.sun.sjcp.Commander
-
java com/sun/sjcp/Commander
-
java -cp com/sun/sjcp Commander
-
java -cp com.sun.sjcp Commander
-
-
-
-
Answer: B
Question No: 165 DRAG DROP – (Topic 2)
Click the Task button.
Answer:
Question No: 166 – (Topic 2)
A JavaBeans component has the following field:
11. private boolean enabled;
Which two pairs of method declarations follow the JavaBeans standard for accessing this field? (Choose two.)
-
public void setEnabled( boolean enabled ) public boolean getEnabled()
-
public boolean setEnabled( boolean enabled ) public boolean getEnabled()
-
public void setEnabled( boolean enabled ) public void isEnabled()
-
public void setEnabled( boolean enabled ) public boolean isEnabled()
Answer: A,D
Question No: 167 – (Topic 2)
Given:
-
package geometry;
-
public class Hypotenuse {
-
public InnerTriangle it = new InnerTriangle();
-
class InnerTriangle {
-
public int base;
-
public int height; 7. }
8. }
Which statement is true about the class of an object that can reference the variable base?
-
It can be any class.
-
The class must belong to the geometry package.
-
The class must be a subclass of the class Hypotenuse.
-
No class has access to base.
-
-
Answer: B
Question No: 168 – (Topic 2)
A class games.cards.Poker is correctly defined in the jar file Poker.jar. A user wants to execute the main method of Poker on a UNIX system using the command:
java games.cards.Poker
What allows the user to do this?
-
put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include
/stuff/java
-
Put Poker.jar in directory /stuff/java, and set the CLASSPATH to include
/stuff/java/Poker.jar
-
put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include
/stuff/java/*.jar
-
put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include
/stuff/java/Poker.jar
-
put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java/*.jar
-
put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java
Answer: B
Question No: 169 – (Topic 2)
Which two statements are true? (Choose two.)
-
An encapsulated class allows subclasses to overload methods, but does NOT allow overriding methods.
-
An encapsulated, public class promotes re-use.
-
Classes that share the same interface are always tightly encapsulated.
-
An encapsulated class allows a programmer to change an implementation without affecting outside code.
Answer: B,D
Question No: 170 – (Topic 2)
Given:
-
interface DeclareStuff {
-
public static final int EASY = 3;
-
void doStuff(int t); }
-
public class TestDeclare implements DeclareStuff {
-
public static void main(String [] args) {
-
int x = 5;
-
new TestDeclare().doStuff( x);
18. }
-
void doStuff(int s) {
-
s = EASY s;
-
System.out.println(quot;s quot; s);
22. }
23. }
What is the result?
-
Compilation fails.
-
s 16
-
s 14
-
An exception is thrown at runtime.
-
s 10
Answer: A
100% Ensurepass Free Download!
–Download Free Demo:1z0-853 Demo PDF
100% Ensurepass Free Guaranteed!
–1z0-853 Dumps
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 |
100-105 Dumps VCE PDF
200-105 Dumps VCE PDF
300-101 Dumps VCE PDF
300-115 Dumps VCE PDF
300-135 Dumps VCE PDF
300-320 Dumps VCE PDF
400-101 Dumps VCE PDF
640-911 Dumps VCE PDF
640-916 Dumps VCE PDF
70-410 Dumps VCE PDF
70-411 Dumps VCE PDF
70-412 Dumps VCE PDF
70-413 Dumps VCE PDF
70-414 Dumps VCE PDF
70-417 Dumps VCE PDF
70-461 Dumps VCE PDF
70-462 Dumps VCE PDF
70-463 Dumps VCE PDF
70-464 Dumps VCE PDF
70-465 Dumps VCE PDF
70-480 Dumps VCE PDF
70-483 Dumps VCE PDF
70-486 Dumps VCE PDF
70-487 Dumps VCE PDF
220-901 Dumps VCE PDF
220-902 Dumps VCE PDF
N10-006 Dumps VCE PDF
SY0-401 Dumps VCE PDF