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!!
Printable View
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!!
?: 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.
Sir Iron Lion,
Thankyou very much, as your name says, you must be a person of strong personality.Thankyou!!
God bless you!:)