Search:

Type: Posts; User: pbrockway2

Search: Search took 0.08 seconds.

  1. [SOLVED] Re: Referencing to Method. Incompatible Types Error.

    That puts you back to square one.

    You say you must use "distance[index] = fillup[index].calcDistance();", but calcDistance() is a void method (does not return anything). Under those conditions...
  2. [SOLVED] Re: Referencing to Method. Incompatible Types Error.

    Shouldn't you be saying something like fillup[index].calcDistance();

    Yes, I know! you did say that. But do both. First fillup[index].calcDistance(); then whatever=fillup[index].getDistance();
  3. [SOLVED] Re: Referencing to Method. Incompatible Types Error.

    I'm just guessing about the triangle example, but I imagine it would be along the lines of:





    public class RightTriangle
    {
    private double myArea;
    private double mySide1;
  4. [SOLVED] Re: Referencing to Method. Incompatible Types Error.

    Yes calcDist() will correctly calculate the distance. But you have to call this method.

    You have to call calcDist() to calculate the distance. And then you can use getDistance() to get the...
  5. [SOLVED] Re: Referencing to Method. Incompatible Types Error.

    That's why I suggested thinking about how getDistance() might be used ;)

    getDistance() will return something, so that's good. But you still have to calculate the distance. Have a look at the...
  6. [SOLVED] Re: Referencing to Method. Incompatible Types Error.

    The incompatible types message occurs because you call calcDistance() which is a void method. That is, it does not return anything. But you try and assign the result to distance[index]. You can't...
Results 1 to 6 of 6