Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Math.PI sometimes works, and sometimes doesn't. Help!?

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    13
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Math.PI sometimes works, and sometimes doesn't. Help!?

    Hello there,

    I wrote this simple code as I'm learning to program in Java, and I don't understand what the problem is with the code. Sometimes it will compile and sometime it shows the error in the image I've attached. Can anyone help?

    Many thanks,

    Alex2.jpg1.jpg


  2. #2
    Member
    Join Date
    Jun 2012
    Location
    Left Coast, USA
    Posts
    451
    My Mood
    Mellow
    Thanks
    1
    Thanked 97 Times in 88 Posts

    Default Re: Math.PI sometimes works, and sometimes doesn't. Help!?

    Quote Originally Posted by RedCloudTsunami View Post
    ...help...
    Give your class another name. Maybe testMath or some such thing.


    Cheers!

    Z

  3. #3
    Super Moderator pbrockway2's Avatar
    Join Date
    Jan 2012
    Posts
    987
    Thanks
    6
    Thanked 206 Times in 182 Posts

    Default Re: Math.PI sometimes works, and sometimes doesn't. Help!?

    <nitpick>Classes should start with an uppercase letter: TestMath, or MathTest or whatever...</nitpick>

    @OP: Ask if you don't see why Math is not a good choice of class name.

Similar Threads

  1. how array works ?
    By erdy_rezki in forum Java Theory & Questions
    Replies: 4
    Last Post: May 1st, 2012, 09:57 AM
  2. I have no idea how this works.
    By GeneralPihota in forum Algorithms & Recursion
    Replies: 3
    Last Post: December 29th, 2011, 09:55 PM
  3. GUI Only Works Sometimes
    By bgd223 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: July 12th, 2011, 08:08 AM
  4. Confusion with Math.toDegrees() and Math.toRadians(). Please help.
    By marksquall in forum Java Theory & Questions
    Replies: 3
    Last Post: June 23rd, 2011, 01:28 AM
  5. This program works but Want to improve
    By SHStudent21 in forum What's Wrong With My Code?
    Replies: 6
    Last Post: January 8th, 2011, 05:53 PM