this is the code I used to compare the chars in String that is input to "" and then would also check the chars before and after "" to see if they are similar in order to return true or false, however the code has an error that says a return value is missing, which i have no clue why?
import java.util.Scanner;
import java.util.Arrays;
public class everyOtherLetter {
public static void main(String[] args) {
Scanner y = new Scanner(System.in);
System.out.println("type a word");
String input = y.next();
char[] t = input.toCharArray();
System.out.println(Arrays.toString(t));
//calling the function for even numbers
//everyOtherLetter(input, true);
//calling the function for odd numbers
//everyOtherLetter(input, false);
sameStarChar(input);
}
private static void everyOtherLetter(String input, boolean even) {
int i =1;
if(even) { //if we need even chars, start with 1;
i=0;
}
for(; i < input.length(); i = i + 2){
System.out.println(input.charAt(i));
}
}
private static boolean sameStarChar(String input) {
int i=0;
for (;i < input.length();i=i+1){
if (input.substring(i,(i+1))=="*"){
if(input.substring((i-1),i)==input.substring((i+1),(i+2))){
return true;
}
else
return false;
}
}
}
}