/* Example of Ternary Operator */
package Conditional;
public class Conditional
{
public static void main(String[] args)
{
int a = 10, b = 15;
int result;
result = (a > b) ? a : b;
prln("Maximum of "+a+ " and "+b+ " is: \t"+result);
}
static void prln(Object anyObject)
{
System.out.println(anyObject);
}
static void pr(Object anyObject)
{
System.out.print(anyObject);
}
}
0 comments:
Post a Comment