Site icon DataFlair

Java Program For Conditional Operators

Get Job-ready: Java Course with 45+ Real-time Projects! - Learn Java

Program 1

class TestCondition
{
    public static void main(String args[])
   {
        char ch='t' ;
       String str;
      str=(ch=='a' || ch=='e' || ch=='i' || ch=='o'|| ch=='u' ||ch=='A' || ch=='E' || ch=='I' || ch=='O'|| ch=='U' ) ? "Character is Vowel":"Character is not vowel";

       System.out.println(str);               
   }
}
Exit mobile version