Online Access Free 1Z0-501 Practice Test
| Exam Code: | 1Z0-501 |
| Exam Name: | Java Certified Programmer |
| Certification Provider: | Oracle |
| Free Question Number: | 147 |
| Posted: | May 30, 2026 |
Given:
1 . public class X (
2 . public object m () {
3 . object o = new float (3.14F);
4 . object [] oa = new object [1];
5 . oa[0]= o;
6 . o = null;
7 . return oa[0];
8 . }
9 . }
When is the float object created in line 3, eligible for garbage collection?
CORRECT TEXT
Given:
3. string foo = "ABCDE";
4. foo.substring(3);
5. foo.concat("XYZ");
6. Type the value of foo at line 6.
Given:
1. class super {
2. public float getNum() {return 3.0f;}
3 . )
4 .
5 . public class Sub extends Super {
6 .
7 .)
Which method, placed at line 6, will cause a compiler error?
Exhibit:
1 . import java.io.IOException;
2 . public class ExceptionTest(
3 . public static void main (String[]args)
4 . try (
5 . methodA();
6 .) catch (IOException e)(
7 . system.out.printIn("Caught IOException");
8 .) catch (Exception e)(
9 . system.out.printIn("Caught Exception");
1 0.)
1 1. )
1 2. public void methodA (){
1 3. throw new IOException ();
14.)
15. )
What is the result?