Hi!
Thank you for helping, and I apologize if this is the wrong thread. I hope I'm posting in the right place.
What I want to do is take two arrays and combine them.
String[] word = {"happy", "live", "walk"};
String[] word2 = {"joy", "full", "forward"};
What I want it to look like is this:
String[] combo = {"happy joy", "live full", "walk forward"};
I am very beginner and am only now taking intro course in school. Here is what I have but it's printing null before each new word and I don't know why. I don't think we learned the part about Arrays.toString for it to print properly but I found that in searching online and don't know if there's some other way to do it for beginner.
Here's what I did do:
I am also trying to figure out how to count vowels in a string array so I can find the word with the least vowels. If two or more words have the fewest, I want the smaller of the two words.
If I have,
String[] wordList = {"hello", "hey", "expression", "both"};
How do I go about getting something back to say "hey"?
I have this, so far:
public static int countVowels(String s) { int count = 0; for(int i = 0; i < arr.length; i++) { if(isVowel(arr.charAt(i))) count++; } return count; } public static boolean isVowel(char ch) { return ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u'; }
If it helps, I've been using CSAwesome and got up to chapter 6