Online Access Free 1Z0-851 Exam Questions

Exam Code:1Z0-851
Exam Name:Java Standard Edition 6 Programmer Certified Professional Exam
Certification Provider:Oracle
Free Question Number:290
Posted:Aug 29, 2025
Rating
100%

Question 1

Given:
1.interface TestA { String toString(); }
2.public class Test {
3.public static void main(String[] args) {
4.System.out.println(new TestA() {
5.public String toString() { return "test"; }
6.});
7.}
8.}
What is the result?

Question 2

Given:
1.import java.util.*;
2.public class WrappedString {
3.private String s;
4.public WrappedString(String s) { this.s = s; }
5.public static void main(String[] args) {
6.HashSet<Object> hs = new HashSet<Object>();
7.WrappedString ws1 = new WrappedString("aardvark");
8.WrappedString ws2 = new WrappedString("aardvark");
9.String s1 = new String("aardvark");
10.String s2 = new String("aardvark");
11.hs.add(ws1); hs.add(ws2); hs.add(s1); hs.add(s2);
12.System.out.println(hs.size()); } } What is the result?

Question 3

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

Question 4

Given:
11.public static void parse(String str) {
12.try {
13.float f = Float.parseFloat(str);
14.} catch (NumberFormatException nfe) {
15.f = 0;
16.} finally {
17.System.out.println(f);
18.}
19.}
20.public static void main(String[] args) {
21.parse("invalid");
22.}
What is the result?

Question 5

Given:
1.public class Threads3 implements Runnable {
2.public void run() {
3.System.out.print("running");
4.}
5.public static void main(String[] args) {
6.Thread t = new Thread(new Threads3());
7.t.run();
8.t.run();
9.t.start();
10.}
11.}
What is the result?

Add Comments

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

insert code
Type the characters from the picture.