package com.sudhirtheindian2.java123 ; public class ternary_operator { public static void main (String[] args) { // How to use ternary operator in java // syntax // (?:) (a>b>c) // find the greatest number among a,b and c int a= 2 , b= 3 , c= 400 ; int result= (a>b)?(a>c?a:c):(b>c?b:c) ; System. out .println(result) ; } }
I want to share my knowledge I am a professional motivational speaker.