0
import java.util.*;

public class Main {
    public static boolean isVowel(String c) {
        return (c == "a" || c == "A"
                || c == "e" || c == "E"
                || c == "i" || c == "I"
                || c == "o" || c == "O"
                || c == "u" || c == "U");
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input1[] = new String[4];

        for (int i = 0; i < input1.length; i++) {
            input1[i] = sc.nextLine();
        }

        int i = 0;
        int j = input1.length;

        while (i < 1) {
            if (isVowel(input1[i]) && isVowel(input1[j - 1])) {
                System.out.print("isVowel string");
            }
            i++;
        }
    }
}

For example, input String array is oreo. so as its first character o (which is vowel) and its last character o (which is also vowel, it could be another vowel character also like e), so at last it should print isvowel string.
But the problem in my program is if condition I am not able to enter in it. I am not able to understand why?

0 Answers0