Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21
  1. #16
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    I lol'd.
    I'm pretty sure AE meant that there is no alert in java, not javascript.
    This thread is bothering me a bit. It appears to be java code (since its type strong), but the required functionality performed is difficult to differentiate between javascript and java.

    Integer.parseInt usage?
    Code:
        public static void main(String[] args)
        {
             Scanner s = new Scanner(System.in);
             boolean isValid;
             int iEntered = 0;
             do
             {
                  System.out.print("Enter a number... ");
                  try
                  {
                       iEntered = Integer.parseInt(s.next());
                       isValid = true;
                  }
                  catch (NumberFormatException ex)
                  {
                       System.out.println("Not a number, try again...");
                       isValid = false;
                  }
             } while (!isValid);
             System.out.println("You entered: " + iEntered);
        }
    Edit:
    Sorry I read bad too :P
    Integer.parseInt actually requires a string, not a double. To convert a double, you'd create a new Double wrapper and execute the d.intValue method (although I could swear I've tried using Integer.parseInt on a double before...)
    Edit:
    Or of course, you can just cast it too

    Last edited by Fou-Lu; 11-13-2008 at 07:46 AM.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  2. #17
    Gox
    Gox is offline
    Regular Coder Gox's Avatar
    Join Date
    May 2006
    Location
    Ontario, Canada
    Posts
    392
    Thanks
    2
    Thanked 20 Times in 20 Posts
    J2ME has an "Alert"....but now we're splitting hairs

  3. #18
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Quote Originally Posted by Gox View Post
    J2ME has an "Alert"....but now we're splitting hairs
    Thats right, midp does have alert!
    We've been told.
    On the other hand... J2ME is to Java as Access is to Oracle
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  4. #19
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Quote Originally Posted by rangana View Post
    Come again? I don't think I understand you on this part.


    I don't exactly get what you mean here.

    I thought, it was parseInt(n), where n could either be a number (includes float) or a string (in this case returns NaN).

    Could you please give me an example on how Integer.parseInt(someint) is used?
    I meant Java but as stated there is an "Alert" but not in the same sense as you are describing it. This entire thread deals with java but every solution you've given has been a javaSCRIPT solution.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  5. Users who have thanked _Aerospace_Eng_ for this post:

    rangana (11-14-2008)

  6. #20
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    I did'nt notice that this thread was in the Java/JSP section. My apologies. Gotta go and delete each of them.
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  7. #21
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Quote Originally Posted by rangana View Post
    I did'nt notice that this thread was in the Java/JSP section. My apologies. Gotta go and delete each of them.
    The OP originally mistakenly posted it in the Javascript forum which might have led to the confusion. The thread was moved then to the Java forum.
    OracleGuy


 
Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •