Beautiful Word: HackerRank
First of all, you did well splitting it up into those methods.

The major issue I have with your code is that the natural translation from the English answers yes/no to Java is to use a boolean. Where true means yes and false means no.

So your isVowel method should be written like this:

static boolean isVowel(char c) {
    if ( (c == 'a') || (c == 'e') || (c == 'i') 
        || (c == 'o') || (c == 'u') || (c == 'y') ) {
        return true;
    }
    return false;
}


Now the next thing you need to know is that a check like c == 'a' is already a boolean, and that the || operator combines 2 booleans into a new boolean. Since we want to return a boolean, instead of writing

if (&lt;boolean check&gt;) {
    return true; 
} else {
    return false;
}


we should just write the following:

return &lt;boolean check&gt;;


which in your case would be:

static boolean isVowel(char c) {
    return (c == 'a') || (c == 'e') || (c == 'i') 
           || (c == 'o') || (c == 'u') || (c == 'y');
}


A final issue with this method is that it's actually package-visible. There is no reason to use this method outside of this class, so it should be private.

private static boolean isVowel(char c) {




The same reasoning applies to the isBeautiful method. So let us also make this private and return a boolean.

private static boolean isBeautiful(String w) {
    for (int i = 0; i &lt; w.length() - 1; ++i) {
        if (w.charAt(i) == w.charAt(i + 1)) {
            return false;
        }
        if (isVowel(w.charAt(i)) &amp;&amp; isVowel(w.charAt(i + 1))) {
            return false;
        }
    }
    return true;
}


Notice how I also simplified the check for 2 consecutive vowels so that it now actually reads: if this character is a vowel and the next character is a vowel.



Now the last thing left to do is use this new isBeautiful method. This means we will change this code:

int result = isBeautiful(w);

if (result == 1) {
    System.out.print("Yes");
} else
    System.out.print("No");


to this:

if (isBeautiful(w) {
    System.out.print("Yes");
} else {
    System.out.print("No");
}


Notice I also added the {} after the else. It's best practice to add curly braces after each if/else/for/while.



One last tip is that you can also rewrite the isVowel method like so:

private static final String VOWELS = "aeiouy";

private static boolean isVowel(char c){
    return VOWELS.contains(c);
}


But this doesn't mean that it's bad to check each character separately - it's just an alternative way.