Want to know Exambible 1Z0-851 Exam practice test features? Want to lear more about Oracle Java Standard Edition 6 Programmer Certified Professional Exam certification experience? Study Downloadable Oracle 1Z0-851 answers to Improve 1Z0-851 questions at Exambible. Gat a success with an absolute guarantee to pass Oracle 1Z0-851 (Java Standard Edition 6 Programmer Certified Professional Exam) test on your first attempt.

2021 Sep amazon 1z0-851:

Q141. Click the Exhibit button. Given:

31. public void method() {

32. A a = new A();

33. a.method1();

34. }

Which statement is true if a TestException is thrown on line 3 of class B?


A. Line 33 must be called within a try block.

B. The exception thrown by method1 in class A is not required to be caught.

C. The method declared on line 31 must be declared to throw a RuntimeException.

D. On line 5 of class A, the call to method2 of class B does not need to be placed in a try/catch block.

Answer: B


Q142. DRAG DROP

Click the Task button.


Answer:


Q143. Given:

11. public class Person {

12. private String name, comment;

13. private int age;

14. public Person(String n, int a, String c) {

15. name = n; age = a; comment = c;

16. }

17. public boolean equals(Object o) {

18. if (! (o instanceof Person)) return false;

19, Person p = (Person)o;

20. return age == p.age && name.equals(p.name);

21. }

22. }

What is the appropriate definition of the hashCode method in class Person?

A. return super.hashCode();

B. return name.hashCode() + age * 7;

C. return name.hashCode() + comment.hashCode() / 2;

D. return name.hashCode() + comment.hashCode() / 2 - age * 3;

Answer: B


Q144. Given:

11. public static Iterator reverse(List list) {

12. Collections.reverse(list);

13. return list.iterator();

14. }

15. public static void main(String[] args) {

16. List list = new ArrayList();

17. list.add("1"); list.add("2"); list.add("3");

18. for (Object obj: reverse(list))

19. System.out.print(obj + ", ");

20. }

What is the result?

A. 3, 2, 1,

B. 1, 2, 3,

C. Compilation fails.

D. The code runs with no output.

E. An exception is thrown at runtime.

Answer: C


Q145. Given:

11. public interface A { public void m1(); }

12.

13. class B implements A { }

14. class C implements A { public void m1() { } }

15. class D implements A { public void m1(int x) { } }

16. abstract class E implements A { }

17. abstract class F implements A { public void m1() { } }

18. abstract class G implements A { public void m1(int x) { } }

What is the result?

A. Compilation succeeds.

B. Exactly one class does NOT compile.

C. Exactly two classes do NOT compile.

D. Exactly four classes do NOT compile.

E. Exactly three classes do NOT compile.

Answer: C


2passeasy.com

Up to the minute ocjp 1z0-851 syllabus:

Q146. DRAG DROP

Click the Task button.


Answer:


Q147. Given:

11. public class Commander {

12. public static void main(String[] args) {

13. String myProp = /* insert code here */

14. System.out.println(myProp);

15. }

16. }

and the command line:

java -Dprop.custom=gobstopper Commander Which two, placed on line 13, will produce the output

gobstopper? (Choose two.)

A. System.load("prop.custom");

B. System.getenv("prop.custom");

C. System.property("prop.custom");

D. System.getProperty("prop.custom");

E. System.getProperties().getProperty("prop.custom");

Answer: DE


Q148. Given:

1. class ClassA {

2. public int numberOfInstances;

3. protected ClassA(int numberOfInstances) {

4. this.numberOfInstances = numberOfInstances;

5. }

6. }

7. public class ExtendedA extends ClassA {

8. private ExtendedA(int numberOfInstances) {

9. super(numberOfInstances);

10. }

11. public static void main(String[] args) {

12. ExtendedA ext = new ExtendedA(420);

13. System.out.print(ext.numberOfInstances);

14. }

15. }

Which statement is true?

A. 420 is the output.

B. An exception is thrown at runtime.

C. All constructors must be declared public.

D. Constructors CANNOT use the private modifier.

E. Constructors CANNOT use the protected modifier.

Answer: A


Q149. Given:

1. public class Venus {

2. public static void main(String[] args) {

3. int [] x = {1,2,3};

4. int y[] = {4,5,6};

5. new Venus().go(x,y);

6. }

7. void go(int[]... z) {

8. for(int[] a : z)

9. System.out.print(a[0]);

10. }

11. }

What is the result?

A. 1

B. 12

C. 14

D. 123

E. Compilation fails.

F. An exception is thrown at runtime.

Answer: C


Q150. DRAG DROP

Click the Task button.


Answer: