About question com.enthuware.ets.scjp.v6.2.13

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

Moderator: admin

Post Reply
fordern
Posts: 2
Joined: Sun Apr 03, 2011 11:38 am
Contact:

About question com.enthuware.ets.scjp.v6.2.13

Post by fordern » Sun Apr 03, 2011 2:02 pm

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?

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

Re: About question com.enthuware.ets.scjp.v6.2.13

Post by admin » Sun Apr 03, 2011 2:51 pm

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.

fordern
Posts: 2
Joined: Sun Apr 03, 2011 11:38 am
Contact:

Re: About question com.enthuware.ets.scjp.v6.2.13

Post by fordern » Sun Apr 03, 2011 4:20 pm

OK Thanks

Guest

Re: About question com.enthuware.ets.scjp.v6.2.13

Post by Guest » Mon Dec 03, 2012 6:01 pm

and what about this.


isCallable should return boolean and
getCallable() should return Boolean.

at least idea intellij generate code like this

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

Re: About question com.enthuware.ets.scjp.v6.2.13

Post by admin » Tue Dec 04, 2012 6:00 am

Guest wrote:and what about this.


isCallable should return boolean and
getCallable() should return Boolean.

at least idea intellij generate code like this
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.

HTH,
Paul.
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 0 guests