Free Oracle 1Z0-501 Exam Dumps Questions & Answers
| Exam Code/Number: | 1Z0-501Join the discussion |
| Exam Name: | Java Certified Programmer |
| Certification: | Oracle |
| Free Question Number: | 147 |
| Publish Date: | Nov 23, 2026 |
| # of views: | 2993 |
|
|
|
Exhibit:
1 . public class SwitchTest {
2 . public static void main (String []args){
3 . System.out.PrintIn("value =" +switchIt(4));
4 .}
5 . public static int switchIt(int x){
6 . int j = 1;
7 . switch (x) {
8 . case 1: j++;
9 . case 2: j++;
1 0. case 3: j++;
1 1. case 4: j++;
1 2. case 5: j++;
1 3. default:j++;
1 4. }
1 5. return j + x;
1 6. }
1 7.}
What is the output from line 3?
Given:
1 . class BaseClass{
2 . private float x= 1.0f;
3 . protected void setVar (float f) {x = f;}
4 . }
5 . class SubClass exyends BaseClass {
6 . private float x = 2.0f;
7 . //insert code here
8 .}
Which two are valid examples of method overriding? (Choose Two)
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 . public class X {
2 . public static void main (String[] args){
3 . byte b = 127;
4 . byte c = 126;
5 . byte d = b + c;
6 .}
7 . }
Which statement is true?