Untitled

 avatar
unknown
java
a year ago
935 B
178
Indexable
public static int findlowerCaseVowelCount(String str){
        int len = str.length();
        int vowelCount = 0;

        for(int i=0; i<len; i++){
            char ch = str.charAt(i);

            if(Character.isLowerCase(ch) == true){
                if(ch == 'a' || ch == 'e' || ch == 'i' || ch=='o' || ch == 'u'){
                    vowelCount++;
                }
            }
        }

        return vowelCount;
    }

    public static void main(String[] args) {
        String s1 = "hello";
        String s1Intern = s1.intern();

        String s3 = new String("hello");
        String s3Intern = s3.intern();
        
        if(s1Intern == s3Intern){
            System.out.println("Yaya, we are equal");
        } else {
            System.out.println("We aren't equal");
        }

        StringBuffer s4 = new StringBuffer("Hi"); // mutable strings
        s4.append("yyy"); 

        System.out.println(s4);
    }
Editor is loading...
Leave a Comment