public class Bond
{
public String ticker;
private double Coupon;
public String getTicker()
{
return ticker;
}
public void setTicker(String ticker)
{
this.ticker = ticker;
}
public double getCoupon()
{
return Coupon;
}
public void setCoupon(double coupon)
{
//do nothing
}
public java.util.Date getMaturity()
{
return new java.util.Date();
}
public boolean isFloater(){ return false; }
public boolean getCallable(){ return true; }
}
I thought the JavaBean naming convention for boolean retrieval was isCallable not as the answer states getCallable().
I would hate to get such a simple question wrong on the real exam, what do others think?
About question com.enthuware.ets.scjp.v6.2.13
Moderator: admin
-
- Posts: 2
- Joined: Sun Apr 03, 2011 11:38 am
- Contact:
-
- Site Admin
- Posts: 9840
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About question com.enthuware.ets.scjp.v6.2.13
As the explanation says, for a boolean property, both - isXXX and getXXX, are valid.
If you like our products and services, please help us by posting your review here.
-
- Posts: 2
- Joined: Sun Apr 03, 2011 11:38 am
- Contact:
Re: About question com.enthuware.ets.scjp.v6.2.13
and what about this.
isCallable should return boolean and
getCallable() should return Boolean.
at least idea intellij generate code like this
isCallable should return boolean and
getCallable() should return Boolean.
at least idea intellij generate code like this
-
- Site Admin
- Posts: 9840
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About question com.enthuware.ets.scjp.v6.2.13
Since a boolean can be autoboxed into Boolean, this doesn't really matter. Further, I am not sure whether what intellij is doing is really the convention.Guest wrote:and what about this.
isCallable should return boolean and
getCallable() should return Boolean.
at least idea intellij generate code like this
HTH,
Paul.
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 1 guest