How to print Vowel or Consonant condition in Java(With Logic Oparetor)

How to print Vowel or  Consonant condition in Java(With Logic Oparetor)

package if_else_control;

import java.util.Scanner;

class VowelConsonantDemo2 {
   
    public static void main(String[] args) {
       
        Scanner input = new Scanner(System.in);
       
        char ch;
       
        System.out.print("Enter a letter : ");
        ch=input.next().charAt(0);
       
        if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u') {
        System.out.println("Vowel");
        }
       
        else {
                System.out.println("Consonant");
                }
         }
            
    }

     }

Run this code in any java editor. Then you can print "Vowel or Consonant condition in java with Logic Oparetor"

How to print "Hello World" in Java



how-to-print-vowel-or-consonant without Logic Oparetor



How to download netbeans with Link

Go To Home




Comments