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

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

 package if_else_control;

import java.util.Scanner;

public class VowelConsonantDemo {
  
    public static void main(String[] args) {
      
    Scanner input = new Scanner(System.in);
  
    char ch;
  
        System.out.println("Enter a letter : ");
        ch =input.next().charAt(0);
      
        if(ch=='a' ) {
            System.out.println("Vowel");
        }
      
        else if(ch=='e' ) {
            System.out.println("Vowel");
        }
      
        else if(ch=='i' ) {
            System.out.println("Vowel");
        }
      
        else if(ch=='o' ) {
            System.out.println("Vowel");
        }
      
        else if(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 without Logic Oparetor"


How to print "Hello world" in Java



How to print "Vowel or Consonant with Logic Oparetor"



How to download netbeans with Link

Go To Home


Comments