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: | May 27, 2026 |
Given:
1.package geometry;
2.public class Hypotenuse {
3.public InnerTriangle it = new InnerTriangle();
4.class InnerTriangle {
5.public int base;
6.public int height;
7.}
8.}
Which statement is true about the class of an object that can reference the variable base?
Given:
1.public class Donkey {
2.public static void main(String[] args) {
3.boolean assertsOn = false;
4.assert (assertsOn) : assertsOn = true;
5.if(assertsOn) {
6.System.out.println("assert is on");
7.}
8.}
9.}
If class Donkey is invoked twice, the first time without assertions enabled, and the second time
with assertions enabled, what are the results?
Which two code fragments correctly create and initialize a static array of int elements? (Choose two.)
Given:
11.public static void main(String[] args) {
12.try {
13.args = null;
14.args[0] = "test";
15.System.out.println(args[0]);
16.} catch (Exception ex) {
17.System.out.println("Exception");
18.} catch (NullPointerException npe) {
19.System.out.println("NullPointerException");
20.}
21.}
What is the result?

