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
About Question enthuware.ocajp.i.v8.2.1417 :
Moderator: admin
-
- Posts: 20
- Joined: Sat Apr 23, 2016 2:52 pm
- Contact:
-
- Site Admin
- Posts: 10062
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.1417 :
Boolean class doesn't have any parseBoolean method that takes boolean as an argument. So I am not sure what is the confusion.
-Paul.
-Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 20
- Joined: Sat Apr 23, 2016 2:52 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.1417 :
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.
Thanks
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"));
}
-
- Posts: 2
- Joined: Fri Mar 04, 2022 2:36 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.1417 :
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?
-
- Site Admin
- Posts: 10062
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.1417 :
yes, right.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 114 guests