I'd rather use a map...
(and follow
Griff's advice on lower case)
import java.util.*;
public class Year
{
public static void main( String args[])
{
Map<String,String> mAns = new HashMap<String,String>();
mAns.put("january", "Ye");
mAns.put("february", "Hello");
mAns.put("march", "He");
mAns.put("april", "H");
mAns.put("may", "Nice");
mAns.put("june", "Very nice");
mAns.put("july", "Well");
mAns.put("august", "Ah");
mAns.put("september", "See");
mAns.put("october", "Oh");
mAns.put("november", "No");
mAns.put("december", "Doh");
Scanner scanner = new Scanner(System.in);
while (true)
{
System.out.println("choose your month 'quit' to terminate:");
String entry = scanner.nextLine();
entry = entry.toLowerCase();
if ( entry.equals("quit") ) break;
System.out.println(answerTo( entry, mAns));
}
System.out.println("goodbye");
}
private static String answerTo( String entry, Map<String, String > ma)
{
String answer = "invalid entry";
if ( ma.containsKey( entry ))
{
answer = ma.get(entry);
}
return answer;
}
}