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 Realistic Oracle 1Z0-851 answers to Leading 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:

Q21. Given:

3. public class Batman {

4. int squares = 81;

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

6. new Batman().go();

7. }

8. void go() {

9. incr(++squares);

10. System.out.println(squares);

11. }

12. void incr(int squares) { squares += 10; }

13. }

What is the result?

A. 81

B. 82

C. 91

D. 92

E. Compilation fails.

F. An exception is thrown at runtime.

Answer: B


Q22. Given:

5. class Atom {

6. Atom() { System.out.print("atom "); }

7. }

8. class Rock extends Atom {

9. Rock(String type) { System.out.print(type); }

10. }

11. public class Mountain extends Rock {

12. Mountain() {

13. super("granite ");

14. new Rock("granite ");

15. }

16. public static void main(String[] a) { new Mountain(); }

17. }

What is the result?

A. Compilation fails.

B. atom granite

C. granite granite

D. atom granite granite

E. An exception is thrown at runtime.

F. atom granite atom granite

Answer: F


Q23. Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object? (Choose two.)

A. When using versions of Java technology earlier than 5.0.

B. When sharing a StringBuffer among multiple threads.

C. When using the java.io class StringBufferInputStream.

D. When you plan to reuse the StringBuffer to build more than one string.

Answer: AB


Q24. Given:

1. public class Threads5 {

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

3. new Thread(new Runnable() {

4. public void run() {

5. System.out.print("bar");

6. }}).start();

7. }

8. }

What is the result?

A. Compilation fails.

B. An exception is thrown at runtime.

C. The code executes normally and prints "bar".

D. The code executes normally, but nothing prints.

Answer: C


Q25. Given:

1. class TestA {

2. public void start() { System.out.println("TestA"); }

3. }

4. public class TestB extends TestA {

5. public void start() { System.out.println("TestB"); }

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

7. ((TestA)new TestB()).start();

8. }

9. }

What is the result?

A. TestA

B. TestB

C. Compilation fails.

D. An exception is thrown at runtime.

Answer: B


1Z0-851  exam engine

Abreast of the times actual test 1z0-851:

Q26. Given:

11. public static void test(String str) {

12. int check = 4;

13. if (check = str.length()) {

14. System.out.print(str.charAt(check -= 1) +", ");

15. } else {

16. System.out.print(str.charAt(0) + ", ");

17. }

18. } and the invocation:

21. test("four");

22. test("tee");

23. test("to");

What is the result?

A. r, t, t,

B. r, e, o,

C. Compilation fails.

D. An exception is thrown at runtime.

Answer: C


Q27. Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object? (Choose two.)

A. When using versions of Java technology earlier than 5.0.

B. When sharing a StringBuffer among multiple threads.

C. When using the java.io class StringBufferInputStream.

D. When you plan to reuse the StringBuffer to build more than one string.

Answer: AB


Q28. A company has a business application that provides its users with many different reports: receivables reports, payables reports, revenue projects, and so on. The company has just purchased some new, state-of-the-art, wireless printers, and a programmer has been assigned the task of enhancing all of the reports to use not only the company's old printers, but the new wireless printers as well. When the programmer starts looking into the application, the programmer discovers that because of the design of the application, it is necessary to make changes to each report to support the new printers. Which two design concepts most likely explain this situation? (Choose two.)

A. Inheritance

B. Low cohesion

C. Tight coupling

D. High cohesion

E. Loose coupling

F. Object immutability

Answer: BC


Q29. A developer is creating a class Book, that needs to access class Paper. The Paper class is deployed in a JAR named myLib.jar. Which three, taken independently, will allow the developer to use the Paper class

while compiling the Book class? (Choose three.)

A. The JAR file is located at $JAVA_HOME/jre/classes/myLib.jar.

B. The JAR file is located at $JAVA_HOME/jre/lib/ext/myLib.jar..

C. The JAR file is located at /foo/myLib.jar and a classpath environment variable is set that includes /foo/

myLib.jar/Paper.class.

D. The JAR file is located at /foo/myLib.jar and a classpath environment variable is set that includes /foo/

myLib.jar.

E. The JAR file is located at /foo/myLib.jar and the Book class is compiled using javac -cp /foo/myLib.jar/

Paper Book.java.

F. The JAR file is located at /foo/myLib.jar and the Book class is compiled using javac -d /foo/myLib.jar

Book.java

G. The JAR file is located at /foo/myLib.jar and the Book class is compiled using javac -classpath /foo/

myLib.jar Book.java

Answer: BDG


Q30. Given:

1. public class TestOne implements Runnable {

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

3. Thread t = new Thread(new TestOne());

4. t.start();

5. System.out.print("Started");

6. t.join();

7. System.out.print("Complete");

8. }

9. public void run() {

10. for (int i = 0; i < 4; i++) {

11. System.out.print(i);

12. }

13. }

14. }

What can be a result?

A. Compilation fails.

B. An exception is thrown at runtime.

C. The code executes and prints "StartedComplete".

D. The code executes and prints "StartedComplete0123".

E. The code executes and prints "Started0123Complete".

Answer: E