When working with recursion I realized I'm not sure how the return statement works. Does it stop and return true when target.contains(key) returns true or does it fall out and return false, because of the line below? Does the previous iterations of the method get finished so that it instead return false?
The program creates passwords and this method is called to check that the password contains one of the required fields, such as upper case letters, symbols or numbers. It's called with 4 separate sources and they are then used to tell the program to keep the password or to create a new one if it doesn't meet the required standards. I've done this program for fun to refresh my memory of Java, it's not a real program that anyone will ever use.
private static boolean containsKeyword(String target, String source, int placement){
String key = String.valueOf(source.charAt(placement));
if(target.contains(key))
return true;
if(placement==0)
return false;
containsKeyword(target, source, placement-1);
return false;
}