About Question enthuware.ocajp.i.v8.2.1417 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
JaredTse
Posts: 20
Joined: Sat Apr 23, 2016 2:52 pm
Contact:

About Question enthuware.ocajp.i.v8.2.1417 :

Post by JaredTse »

Hi All,

I am a bit confused about this question. Should't the answer include

parseBoolean(boolean )

Since its a member of the Boolean class. I understand is overloaded but how can you tell which one is the correct to pick ?

Thanks

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

Re: About Question enthuware.ocajp.i.v8.2.1417 :

Post by admin »

Boolean class doesn't have any parseBoolean method that takes boolean as an argument. So I am not sure what is the confusion.
-Paul.
If you like our products and services, please help us by posting your review here.

JaredTse
Posts: 20
Joined: Sat Apr 23, 2016 2:52 pm
Contact:

Re: About Question enthuware.ocajp.i.v8.2.1417 :

Post by JaredTse »

Hi Paul,

You are right, I have opened the Boolean class and searched for a method called parseBoolean(boolean ) that takes a boolean as argument and did not find any. I assumed that it had an overloaded version, which takes boolean. Obviously I was wrong. But I did find the sting version.

Code: Select all

    public static boolean parseBoolean(String s) {
        return ((s != null) && s.equalsIgnoreCase("true"));
    }
Thanks

cronicmanga
Posts: 2
Joined: Fri Mar 04, 2022 2:36 pm
Contact:

Re: About Question enthuware.ocajp.i.v8.2.1417 :

Post by cronicmanga »

The first explanation says there are 2 constructors, - Boolean(String) and Boolean(boolean), but it also marks Boolean(Boolean ) as a wrong answer. Is this like a difference between Boolean and boolean?

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

Re: About Question enthuware.ocajp.i.v8.2.1417 :

Post by admin »

yes, right.
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 55 guests