its probably something really daft but it wont work!


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: its probably something really daft but it wont work!

  1. #1
    Join Date
    Oct 2005
    Posts
    15

    its probably something really daft but it wont work!

    here is the code

    {
    double a = double.parseDouble(txtRadius.getText());
    double b = 3.14;
    double c = a * b;
    txtCircumference.setText(String.valueOf(c));
    }

    It is a small piece of code to calculate the circumference of a circle, when i compile it on netbeans I get a class error.

    Any help would be appreciated!

    Ta,
    Steve

  2. #2
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    parseDouble is a static method of the Double class (not the double class...)
    so:
    Code:
    double a = Double.parseDouble(txtRadius.getText());
    eschew obfuscation

  3. #3
    Join Date
    Oct 2005
    Posts
    15
    thanks!

Similar Threads

  1. Data Entry Work
    By Anjana Jonathan in forum Careers
    Replies: 5
    Last Post: 07-03-2006, 04:15 AM
  2. Replies: 3
    Last Post: 02-23-2003, 03:05 AM

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