Search:

Type: Posts; User: copeg

Search: Search took 0.07 seconds.

  1. Replies
    8
    Views
    2,351

    Re: check for valid argument to a method

    Yes, don't feed Strings. The Integer class has a parseInt method that allows you to parse a String into an int, and it will throw a NumberFormatException if the String cannot be parsed into an int,...
  2. Replies
    8
    Views
    2,351

    Re: check for valid argument to a method

    You should read the definitions of compile time and runtime error. Compile time occurs when you compile your application, and in the most basic sense NEVER seen by a user.

    Compile Time Error:

    ...
  3. Replies
    8
    Views
    2,351

    Re: check for valid argument to a method

    That does not make sense. Given you have defined the method as such, if you attempt to pass anything other than an int you will get a compile time error. Thus there is no reason to deal with this at...
  4. Replies
    8
    Views
    2,351

    Re: check for valid argument to a method

    By definition...


    public static int calcRoot(int a)


    ....a is an Integer. I'm not sure what you wish to check...do you wish to check if it is positive (for instance, the Math.sqrt of a...
Results 1 to 4 of 4