Just passed 1Z0-808 - thank you!

Post Reply
michaelrfarcasin
Posts: 13
Joined: Thu May 16, 2024 5:30 pm
Contact:

Just passed 1Z0-808 - thank you!

Post by michaelrfarcasin »

I took 7 practice exams from the enthuware test studio, studied between each one, and only took the Oracle exam after I got over 80% on the practice. I can say I learned a lot from the practice exams and this site, and I'm grateful. I don't know that I could have passed the exam before this.

On the subject of the exam, I saw a few things that I didn't see in the practice and might be useful to enthuware. I won't copy the exam questions but I'll give examples like the exam.

1. String s = (String) (1+2)
2. What change would make the following compile?

Code: Select all

abstract class A { 
    protected void foo() {} 
    abstract void bar();
}
class B extends A { 
    private void foo() {} // line 1
    private void bar() {} // line 2
}
Weirdly the question like this on the exam forced me to select only one answer, and none of the options addressed the reduced visibility in both lines 1 and 2, so I don't think any of the answers were correct. Not sure what to do about that.
3. This is similar to a practice exam question, except it has a static variable and none of the answer options were "this won't compile". Not sure what to do about that.

Code: Select all

class X {
    static int someVar;

    public int foo() {
        int b, h;
        if (someVar == 0) {
            b = 2;
            h = 3;
        }
        return b * h; // local variable may not have been initialized
    }
}
4. String.indexOf(String, int)
5. Which of these compile?
- a class with a private constructor
- an abstract class with a constructor
- a final abstract class
- a class with protected static final int i = 0;
- a private class
6. I still don't understand why this compiles and runs successfully. It looks like Foo.equals overrides Object.equals, so I would have expected the compiler to say "Hello" is an incompatible type for equals(). I just had someone explain it to me. Overloading, not overriding. Anyway it's like a question on the exam.

Code: Select all

class Foo{ 
    String s = "";
    public boolean equals(Foo f) {
        return s.toString().equalsIgnoreCase(f.s.toString());
    }
}
public class TestClass extends Foo{
    public static void main(String[] args){
        Foo f = new Foo();
        f.s = "Hello";
        System.out.println(f.equals("Hello")); // prints: false
    } 
}

admin
Site Admin
Posts: 10242
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: Just passed 1Z0-808 - thank you!

Post by admin »

Congratulations !! Happy to know that our material was helpful in your preparation.
thank you for your feedback!
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest