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 »

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: 10382
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

As the explanation says, for a boolean property, both - isXXX and getXXX, are valid.

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 »

OK Thanks

Guest

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

Post by Guest »

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: 10382
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 64 guests