Ternary Operators Def: In ternary operators we use 3 operands. syntax: expr1 ? expr2 : expr3 Note: Result of expr1 should be boolean in java. Demo: public class Ternary{ public static void main(String args[]){ //ternary operator int a=5; System.out.println( a>4 ? "a is greater than 4" : "a is less than equal to 4"); } } output is: a is greater than 4
Translate
Wednesday, 22 June 2016
Java Ternary Operator
Subscribe to:
Post Comments (Atom)
-
HII guys this is totally geometry based problem there is nothing to code just use formula LOGIC::how to find centroid of a polygon u c...
No comments:
Post a Comment