Hi,
I have a question. I have two methods below.
public void A() {
//some code
return;
}
public boolean B() {
//I want to call A(), but how can I return something like true, or false
}
Eric Sosman - 30 May 2006 17:09 GMT
Tom wrote On 05/30/06 12:04,:
> Hi,
>
[quoted text clipped - 11 lines]
>
> }
Simplicity itself:
public boolean B() {
A(); // calls A()
return true; // returns "something like" true or false
}
If you don't find this answer satisfactory, please explain
your goals in more detail. For example, describing why this
answer doesn't meet your needs might be a good start.

Signature
Eric.Sosman@sun.com
Chris Smith - 30 May 2006 17:13 GMT
> I have a question. I have two methods below.
>
[quoted text clipped - 9 lines]
>
> }
I'm not sure what you're asking. A() can not return anything, since
it's declared void. B() can return something. If you want B to call A
and then return something, it looks like this:
public boolean B()
{
A();
return true;
}
Incidentally, it would be better to name those methods a and b, not A
and B. Method names in Java begin with lower-case letters.

Signature
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation