how the constructor can call this method?

Joined
Oct 17, 2008
Messages
2
Reaction score
0
When the constructor is executed, how can i have the string message of "nodiscount" or "discount " than have to call the method to get this message?Do i have to call the method checkPriceStatus in the constructor?And is this possible?I mean i want this string message appearing when the constructor is executed and not when i call the method .

/**
* Returns the appropiate message if the price is less 64
*/
public String checkPriceStatus()
{
if(price < 64 ){
return "nodiscount";
}
else {
return "discount included";
}
}
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top