Results 1 to 6 of 6
  1. #1
    JavaDreams is offline Member
    Join Date
    Jan 2011
    Posts
    18
    Rep Power
    0

    Post Please help,just a small question

    In the below code what is the meaning of this line.
    • return(i<=j) ? i : j ;


    public static int minimum(int i,int j)
    {
    return(i<=j) ? i : j ;
    }

    What does this question mark means, please explain!!

  2. #2
    Iron Lion is offline Senior Member
    Join Date
    Nov 2010
    Posts
    210
    Rep Power
    4

    Default

    ?: is the ternary conditional operator. Its form is:
    condition ? value-if-true : value-if-false

    In your example, the method evaluates i <= j, and returns i if it is true, or j if it is false.

  3. #3
    JavaDreams is offline Member
    Join Date
    Jan 2011
    Posts
    18
    Rep Power
    0

    Smile

    Sir Iron Lion,
    Thankyou very much, as your name says, you must be a person of strong personality.Thankyou!!
    God bless you!:)

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

    Default

    Quote Originally Posted by JavaDreams View Post
    Sir Iron Lion,
    Thankyou very much, as your name says, you must be a person of strong personality.Thankyou!!
    God bless you!:)
    That's exactly the reason why I dropped my previous nick name Droopy.

    kind regards,

    Jos ;-)
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    JavaDreams is offline Member
    Join Date
    Jan 2011
    Posts
    18
    Rep Power
    0

    Default

    Quote Originally Posted by JosAH View Post
    That's exactly the reason why I dropped my previous nick name Droopy.

    kind regards,

    Jos ;-)
    Absolutely right sir!!
    It's really nice to see your comment.
    Looking forward your guidence on this forum..

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

    Default

    Quote Originally Posted by JavaDreams View Post
    Absolutely right sir!!
    and don't call me "Sir".

    kind regards,

    Loretta ;-)
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Read this SMALL post BEFORE you submit a question.
    By AcousticBruce in forum New To Java
    Replies: 11
    Last Post: 01-10-2011, 11:22 AM
  2. a small advice
    By java_newby in forum New To Java
    Replies: 10
    Last Post: 12-04-2010, 09:37 PM
  3. small problem
    By rawan in forum Java Applets
    Replies: 2
    Last Post: 04-07-2010, 03:32 AM
  4. small question about 'this'
    By GPB in forum New To Java
    Replies: 3
    Last Post: 02-28-2010, 05:46 PM
  5. A small Question
    By Eku in forum JDBC
    Replies: 7
    Last Post: 09-01-2008, 06:10 AM

Tags for this Thread

Posting Permissions

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