Tuesday, September 13, 2016


Conditional Operator:-

If the condition is true then expression 1 will be executed otherwise
expression 2 will be executed. Syntax:- condition ? exp 1 : exp 2 Lets have a program on Relational Operator class Conditional { Public Static void main(String args[]) { int a=, b=35, max; System.Out.println("the value of a="+a); System.Out.println("the value of b="+b); max= a>b ? a : b; System.Out.println(" max of a,b=" +max); } }

No comments:

Post a Comment