| Exam Code/Number: | 1Z0-851Join the discussion |
| Exam Name: | Java Standard Edition 6 Programmer Certified Professional Exam |
| Certification: | Oracle |
| Question Number: | 290 |
| Publish Date: | May 27, 2026 |
|
Rating
100%
|
|
Given a correctly compiled class whose source code is:
1.package com.sun.sjcp;
2.public class Commander {
3.public static void main(String[] args) {
4.// 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 "." (current directory). Which command line correctly runs Commander?
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.)
Which two code fragments are most likely to cause a StackOverflowError? (Choose two.)
Given:
11.public void genNumbers() {
12.ArrayList numbers = new ArrayList();
13.for (int i=0; i<10; i++) {
14.int value = i * ((int) Math.random());
15.Integer intObj = new Integer(value);
16.numbers.add(intObj);
17.}
18.System.out.println(numbers);
19.}
Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbage collection?
Given:
11.String test = "Test A. Test B. Test C.";
12.// insert code here
13.String[] result = test.split(regex);
Which regular expression, inserted at line 12, correctly splits test into "Test A", "Test B", and "Test C"?