Cannot resolve symbol problem?!?!?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Cannot resolve symbol problem?!?!?

  1. #1
    Join Date
    Nov 2004
    Posts
    5

    Cannot resolve symbol problem?!?!?

    Hi I'm just starting out on Java and when I compile the following code I get the error Cannot resolve symbol


    class FloatingBarge {

    // ---------------------- FIELDS ---------------------

    private double length, breadth, height;

    // ------------------ CONSTRUCTORS -------------------

    /* Constructor */

    public FloatingBarge(double newL, double newB, double newH) {
    length = newL;
    breadth = newB;
    height = newH;
    }

    // --------------------- METHODS ---------------------

    /* Calculate SurfaceArea */

    public void calculateSurfaceArea() {

    // Calculate SurfaceArea

    SurfaceArea = ((2*H)*(L+B)+(L*B));
    }

    /* Calculate MassOfBarge */

    public void calculateMassOfBarge() {

    // Calculate MassOfBarge

    MassOfBarge = ((2*H)*(L+B)+LB)*1.06;
    }

    /* Calculate Draft */

    public void calculateDraft() {

    // Calculate Draft

    Draft = (((2*H)*(L+B)+LB)*1.06)/(L*B);
    }

    /* Return Draft */

    public double getDraft() {
    return(draft);
    }
    }

    the ones in red are the symbols the compiler cannot resolve, any help ASAP would be much much appreciated!!! Thanks.

  2. #2
    Join Date
    Sep 2004
    Posts
    223
    it simply means that the variables that it is pointing to (ie the H, L SurfaceArea and B ) do not exsist, you need to initiate them.

    Im guessing the H means height, L means length and B means base???

    so keep in mind that if you say (2 * H), like you have, all that java will do is multiply 2 by the value in the H variable, if it cant find the H variable, then it will give you the old cannot resolve symbol error

    as for the SurfaceArea, is that a class? if not you should never name a variable with an uppercase name, keep it lowercase for the first letter, ie. surfaceArea

    if it is a class, then you cannot assign it to equal an int,

    ((2*H)*(L+B)+(L*B))

    will return an int (or double depending on what H, L and B are defined as)
    A kram a day keeps the doctor......guessing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center