Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Netbeans and Arguments (n00bish question)
#1
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 {
    public static void main(String[] args){
        int number = 100;
        if (args.length > 0) {
            number = Integer.parseInt(args[0]);
        }
        System.out.println("The square root of "
                + number
                + " is "
                + Math.sqrt(number));
    }
}
I went to Run>Set Project Configuration>Customize and changed the argument to 169. I ran the file and it gives me the output of
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.
Reply


Messages In This Thread
Netbeans and Arguments (n00bish question) - by shadywatcher212 - 05-08-2010, 07:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  netbeans error ?? prince76 1 1,094 03-22-2012, 08:56 AM
Last Post: redpois0n
  How do I turn off auto-format and auto-resize in Netbeans? nevets04 0 2,068 12-01-2009, 07:20 PM
Last Post: nevets04

Forum Jump:


Users browsing this thread: 1 Guest(s)