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: | Sep 24, 2026 |
| # of views: | 2839 |
|
|
|
Exhibit:
1 . class A {
2 . public byte getNumber (){
3 .return 1;
4 .}
5 .}
6 .
7 . class B extends A {
8 . public short getNumber() {
9 . return 2;
1 0. }
1 1.
1 2. public static void main (String args[]) {
1 3.B b = new B ();
1 4.System.out.printIn(b.getNumber())
1 5.}
1 6. }
What is the result?
Given:
1 . public class Test {
2 . public static void main (String []args){
3 . unsigned byte b = 0;
4 . b--;
5 .
6 .}
7 . }
What is the value of b at line 5?
CORRECT TEXT
Given:
AnInterface is an interface.
AnAdapter0 is a non-abstract, non-final class with a zero argument constructor.
AnAdapter1 is a non-abstract, non-final class without a zero argument constructor, but with a constructor that takes one int argument.
Which two construct an anonymous inner class? (Choose Two)
F.AnAdapter1 aa=new AnAdapter1(){}
G.AnAdapter0 aa=new AnAdapter0(){}
H.AnAdapter0 aa=new AnAdapter0(5){}
I.AnAdapter1 aa=new AnAdapter1(5){}
J.AnInterface a1=new AnInterface(5){}
Given:
1 . public class Foo implements Runnable (
2 . public void run (Thread t) {
3 . system.out.printIn("Running.");
4 . }
5 . public static void main (String[] args){
6 . new thread (new Foo()).start();
7 . )
8 . )
What is the result?
CORRECT TEXT
Exhibit:
1 . public class test {
2 . public static string output = ""
3 .
4 . public static void foo(int i) {
5 . try {
6 . if(i= =1) {
7 . throw new Exception ();
8 .}
9 . output += "1";
1 0. )
1 1. catch(Exception e) {
1 2. output += "2";
1 3. return;
1 4. )
1 5. finally (
1 6. output += "3";
1 7. )
1 8. output += "4";
1 9. )
2 0.
2 1. public static void main (string args[])(
2 2. foo(0);
2 3. foo(1);
2 4.
2 5.)
2 6. )
What is the value of the variable output at line 24?