Use a method to find out if any last name is "Doe".
I need to use a method to find out if any last name is "Doe". Use a loop statement to achieve this. Print out their full names.
Here is the code that I have written. It works but I not sure that it addresses the question. Need help. Thanks in advance.
class LastNameisDoe {
public static void main(String args[]) {
String s;
for(int i=0; i < 1; i++) {
s = "Doe";
System.out.print(s);
s = " John Doe";
System.out.print(s + " ");
}
}
}
Re: Use a method to find out if any last name is "Doe".
Quote:
find out if any last name is "Doe"
First you need to find the "last name". Given a String with a name, how do you find the "last" name?
When you get the last name, Then compare it to "Doe"
Re: Use a method to find out if any last name is "Doe".
Re: Use a method to find out if any last name is "Doe".