Results 1 to 6 of 6
Thread: Math.sqrt is not working
 04082012, 03:32 AM #1Member
 Join Date
 Apr 2012
 Posts
 3
 Rep Power
 0
Math.sqrt is not working
Hi, I am a bit new to java and a simple command I want to use does not work in NetBeans. Every time I type Math.sqrt(number) sqrt can never be found.
Java Code:class Root{ public static void main(String[] args){ int number = 225; System.out.println("The square root of " + number + " is " + Math.sqrt(number) ); } }
Last edited by pbrockway2; 04082012 at 04:08 AM. Reason: code tags added
 04082012, 04:07 AM #2Moderator
 Join Date
 Feb 2009
 Location
 New Zealand
 Posts
 4,712
 Rep Power
 14
Re: Math.sqrt is not working
That code works fine for me. Make sure you haven't defined your own class called Math which is getting the road of the compiler locating the java.lang.Math class.

Also, when you post code use the "code" tags. Put [code] at the start of the code and [/code] at the end to ensure that the code is readable when it appears here.Last edited by pbrockway2; 04082012 at 04:09 AM.
 04082012, 05:10 AM #3Member
 Join Date
 Apr 2012
 Posts
 3
 Rep Power
 0

Re: Math.sqrt is not working
 04082012, 05:18 AM #5Member
 Join Date
 Apr 2012
 Posts
 3
 Rep Power
 0
Re: Math.sqrt is not working
Thank you so much!!! :)

Similar Threads

Adding a sqrt button and percentage button to a calculator
By Josie_Taylor in forum New To JavaReplies: 4Last Post: 03142011, 02:16 AM 
Does any one know how to write this e^sqrt(lognloglog(n)) ,where n is biginteger
By ajay.eeralla in forum New To JavaReplies: 3Last Post: 03082011, 06:15 AM 
\n not working in GUI (working code, but \n isn't working)
By cc11rocks in forum New To JavaReplies: 2Last Post: 01042011, 05:30 AM 
Create Math.sin without math.sin
By vudoo in forum New To JavaReplies: 11Last Post: 12072010, 07:23 AM 
Java mail problem(working in intranet,but not working in iternet)
By sundarjothi in forum Advanced JavaReplies: 8Last Post: 05282008, 07:00 AM
Bookmarks