Results 1 to 5 of 5
Like Tree1Likes
  • 1 Post By doWhile

Thread: newbie question

  1. #1
    palcente is offline Member
    Join Date
    Feb 2012
    Posts
    3
    Rep Power
    0

    Default newbie question

    Hi, I have just started with java, I'm playing with application which will ask for few numbers and do some calculations on them.
    I have few methods already, and the one, that will handle the calculations is going to be asking user for couple of numbers.


    I have managed to display input box and apply error message in case integer is not a result of the input...
    Now I want to ask for another few numbers with same error handling...

    Newbie way would be to just to copy whole chunk of the code few more times..

    My question is:

    Can I do it in a different way?

  2. #2
    tnrh1 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    251
    Rep Power
    4

    Default Re: newbie question

    Just use the OR operator to ask few boolean questions in one if statement.
    Ask first if it's an Integer because if not, you will get a type mismatch error incase the input is not an Integer.

  3. #3
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

  4. #4
    tnrh1 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    251
    Rep Power
    4

    Default Re: newbie question

    If he wants to ask few question on one input box he can do that by one if statement.
    Or I didn't understand his question

  5. #5
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: newbie question

    Quote Originally Posted by tnrh1 View Post
    If he wants to ask few question on one input box he can do that by one if statement.
    Or I didn't understand his question
    The original poster did not elucidate the question well enough which left us guessing. You had your guess, I had mine.
    tnrh1 likes this.

Similar Threads

  1. Newbie Question - Switch
    By R0bert0 in forum New To Java
    Replies: 1
    Last Post: 07-16-2011, 04:19 AM
  2. Probably a newbie question.... :P
    By gblax123 in forum New To Java
    Replies: 9
    Last Post: 02-23-2011, 10:21 PM
  3. Newbie question
    By MrNiceGuy in forum New To Java
    Replies: 8
    Last Post: 11-12-2010, 05:29 AM
  4. newbie question
    By ronguilmet in forum New To Java
    Replies: 2
    Last Post: 11-16-2009, 02:37 AM
  5. Newbie question; Vectors
    By Kern in forum New To Java
    Replies: 7
    Last Post: 08-03-2008, 06:59 AM

Posting Permissions

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