I am new to Java. I'm trying to make a program where the user inputs a country and it returns the current time in that country. I have this code:
public static void main(String[] args) {
Scanner userInput = new Scanner(System.in);
System.out.println("Enter a country: ");
String userCountryInput = userInput.nextLine();
if (userInput.equals("Philippines")) {
Date date1 = new Date();
System.out.println(date1);
}
if (userInput.equals("Russia")) {
TimeZone.setDefault(TimeZone.getTimeZone("UTC + 05:30"));
Date date2 = new Date();
System.out.println(date2);
}
}
When I enter "Russia" or "Philippines" it does not output anything. Any idea why?