Netbeans and Arguments (n00bish question) - Printable Version +- Support Forums (https://www.supportforums.net) +-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87) +--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18) +---- Forum: Java Programming (https://www.supportforums.net/forumdisplay.php?fid=22) +---- Thread: Netbeans and Arguments (n00bish question) (/showthread.php?tid=6922) |
Netbeans and Arguments (n00bish question) - shadywatcher212 - 05-08-2010 Ok so this is a really n00bish question but i cant seem to find an answer for this. Here is my source code: Code: class NewRoot { Code: The square root of 100 is 10.0 My question is why is it not taking the argument of 169 instead of evaluating 100? I checked the length of the argument and its 3. Any help would be appreaciated. Dont be to harsh im still begining Java. RE: Netbeans and Arguments (n00bish question) - uber1337 - 05-13-2010 Well I'm no Java expert but the only function argument you have is: Code: (String[] args) Code: int number = 100; For example, running this code: Code: class NewRoot { Makes it output the square root of 25. Similarly, this script asks for a number from the user using a scanner object: Code: import java.util.*; Code: What number do you want the square root of?:25 More on scanner objects here RE: Netbeans and Arguments (n00bish question) - shadywatcher212 - 05-17-2010 Ok that helps a little bit but maybe i should have worded it my question a little better. Before I ran it i changed the arguments in NetBeans to "169". So when the file tests Code: if(args.length > 0){ Code: number = parse.Interger(args[0]); Code: The square root of 169 is 13 |