/*********************************************************************** * Author: Eric Heim * Date Created: 5/31/2011 * Course: CS0007 * Description: Shows the functionality of the logical AND operator * by determining if the user inputs an affirmative * response twice ***********************************************************************/ import java.util.Scanner; public class LogicalAndOperator { public static void main(String[] args) { char walks, quacks; Scanner keyboard = new Scanner(System.in); System.out.print("Does it walk like a duck (Y or N)? "); walks = keyboard.nextLine().charAt(0); System.out.print("Does it quack like a duck (Y or N)? "); quacks = keyboard.nextLine().charAt(0); if(walks == 'Y' && quacks == 'Y') { System.out.println("It's proabably a duck."); } else { System.out.println("It's proabably NOT a duck."); } } }