/* An if - else example. A program to advise you if you need an umbrella; takes a String input and converts it to a character. */ import java.util.Scanner; class Advisor1 { public static void main(String[] args) { Scanner scan = new Scanner (System.in); System.out.print ("Is it raining outside? (Y/N) "); /* Read the input as a String object and call chatAt(0) to return the very first character of that String object. */ char reply = (scan.nextLine()).charAt(0); if (reply == ('Y') || reply == ('y')) System.out.println ("Do not forget your umbrella."); else System.out.println ("You do not need an umbrella for now."); } }