Results 1 to 7 of 7

Thread: refresh help

  1. #1
    silverspoon34 is offline Member
    Join Date
    Nov 2009
    Posts
    18
    Rep Power
    0

    Smile refresh help

    Hi all

    doing second year of degree this is not for an assignment but refreshing and cant remember how to change something so please can someone remind me.

    I am doing a basic program finding the highest number and lowest number out of user inputs so below is a line point where i cant emember where to go.

    Java Code:
    if(num1 <num2 || num1 <num3)
    Then i want to say that if num 1 is less than num2 and num3 then num1 = XX but then is not an operator and my mind is blank

    got a feeling it a system.out.print method but i not 100% please help.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,365
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by silverspoon34 View Post
    Hi all

    doing second year of degree this is not for an assignment but refreshing and cant remember how to change something so please can someone remind me.

    I am doing a basic program finding the highest number and lowest number out of user inputs so below is a line point where i cant emember where to go.

    Java Code:
    if(num1 <num2 || num1 <num3)
    Then i want to say that if num 1 is less than num2 and num3 then num1 = XX but then is not an operator and my mind is blank

    got a feeling it a system.out.print method but i not 100% please help.
    Strange: in your text you write "if num1 is less than num2 and num3 ..." but in your code your write f num1 is less than num2 or num1 is less than num3". w.r.t. your question: Java (nor C nor C++) have a 'then' keyword; the syntax simply is:

    Java Code:
    if (<condition>) statement;
    Note that a block statement { ... } is also a statement so you can put this:

    Java Code:
    if (<condition>) {
       // bunch of statements here
    }
    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    silverspoon34 is offline Member
    Join Date
    Nov 2009
    Posts
    18
    Rep Power
    0

    Default refresh

    ok but how do I then get the program to put the result from num1 into intxx as I have to do this program over 3 integers entered so xx could change and at the end of program highest (XX) and lowest(YY) will be printed

    suppose i could use 2 empty arrays but i still need num1,2 or 3 which ever is greatest to end up in XX

  4. #4
    silverspoon34 is offline Member
    Join Date
    Nov 2009
    Posts
    18
    Rep Power
    0

    Thumbs up refresh

    all come back to me with a slight prodding thanks

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,365
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by silverspoon34 View Post
    ok but how do I then get the program to put the result from num1 into intxx as I have to do this program over 3 integers entered so xx could change and at the end of program highest (XX) and lowest(YY) will be printed

    suppose i could use 2 empty arrays but i still need num1,2 or 3 which ever is greatest to end up in XX
    Simply stick all your numbers in array and use a method from the Arrays utility class (read its API documentation) to sort those numbers; the first one is the lowest one and the last one is the highest number after sorting.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  6. #6
    deepthycimat is offline Member
    Join Date
    Mar 2011
    Location
    Bangalore
    Posts
    1
    Rep Power
    0

    Default

    <moderator edit: hijack post deleted>
    Last edited by Fubarable; 03-29-2011 at 02:15 AM.

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Refresh jList
    By karq in forum New To Java
    Replies: 1
    Last Post: 07-16-2010, 02:58 AM
  2. How to refresh my JInternalFrame upon CUD
    By chyrl in forum AWT / Swing
    Replies: 2
    Last Post: 04-01-2010, 04:22 PM
  3. Refresh Button?
    By jls7168 in forum New To Java
    Replies: 2
    Last Post: 02-06-2009, 06:44 PM
  4. Jpanel won't refresh
    By alon2580 in forum AWT / Swing
    Replies: 3
    Last Post: 08-22-2008, 05:26 PM
  5. Refresh the page
    By udhayageetha in forum AWT / Swing
    Replies: 2
    Last Post: 07-01-2008, 09:03 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
  •