Adding 2 object fields


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Adding 2 object fields

  1. #1
    Pete Guest

    Adding 2 object fields


    I'm trying to add two object fields and assign the total
    to sum:

    int sum = ((objmilli.millimeters) + (objcenti.centimeters));

    I keep getting an error. Can you tell me what's wrong with
    my syntax ?

    Thanks.....

    Pete

  2. #2
    Brad O'Hearne Guest

    Re: Adding 2 object fields

    Pete,

    Can you give me a little more info? What is the compile error, and what are
    the declared data types of the two object members you are trying to sum?
    Also, I presume you have actually instantiated the two objects in question?
    (Perhaps posting the entire method body code would help).

    BradO
    ----------
    Brad O'Hearne
    DevX Section Leader

    "Pete" <java.@127.0.0.1> wrote in message news:3d87946c$1@10.1.10.29...
    >
    > I'm trying to add two object fields and assign the total
    > to sum:
    >
    > int sum = ((objmilli.millimeters) + (objcenti.centimeters));
    >
    > I keep getting an error. Can you tell me what's wrong with
    > my syntax ?
    >
    > Thanks.....
    >
    > Pete




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