Oracle Java Certified Programmer - 1Z0-501 Exam Practice Test
Exhibit:
1 . public class X {
2 . public static void main (String[]args){
3 . int [] a = new int [1]
4 . modify(a);
5 . System.out.printIn(a[0]);
6 .}
7 .
8 . public static void modify (int[] a){
9 .a[0] ++;
1 0.}
1 1. }
What is the result?
1 . public class X {
2 . public static void main (String[]args){
3 . int [] a = new int [1]
4 . modify(a);
5 . System.out.printIn(a[0]);
6 .}
7 .
8 . public static void modify (int[] a){
9 .a[0] ++;
1 0.}
1 1. }
What is the result?
Correct Answer: A
Vote an answer
Given:
1 . public interface Foo{
2 . int k = 4;
3 .}
Which three are equivalent to line 2? (Choose Three)
1 . public interface Foo{
2 . int k = 4;
3 .}
Which three are equivalent to line 2? (Choose Three)
Correct Answer: A,D,H
Vote an answer
Which gets the name of the parent directory file "file.txt"?
Correct Answer: D
Vote an answer
Exhibit:
ClassOne.java
1. package com.abc.pkg1;
2. public class ClassOne {
3. private char var = 'a';
4. char getVar() {return var;}
5. } ClassTest.java
1 . package com.abc.pkg2;
2 . import com.abc.pkg1.ClassOne;
3 . public class ClassTest extends ClassOne {
4 . public static void main(String[]args){
5 .char a = new ClassOne().getVar();
6 .char b = new ClassTest().getVar();
7 .}
8 . }
What is the result?
ClassOne.java
1. package com.abc.pkg1;
2. public class ClassOne {
3. private char var = 'a';
4. char getVar() {return var;}
5. } ClassTest.java
1 . package com.abc.pkg2;
2 . import com.abc.pkg1.ClassOne;
3 . public class ClassTest extends ClassOne {
4 . public static void main(String[]args){
5 .char a = new ClassOne().getVar();
6 .char b = new ClassTest().getVar();
7 .}
8 . }
What is the result?
Correct Answer: C
Vote an answer
Which statement is true for the class java.util.ArrayList?
Correct Answer: A
Vote an answer