Assignemnt #30 ComparingStrings
Code
///Name: Morgan Kaplan
///Period: 5
///Project Name: ComparingStrings
///File Name: ComparingStrings.java
import java.util.Scanner;
public class ComparingStrings
{
public static void main( String[] args )
{
Scanner momo= new Scanner(System.in);
String word;
boolean yes, no;
System.out.println( " Type the word \"weasel\", please." );
word=momo.next();
yes= "weasel".equals(word);
no= ! word.equals("weasel");
System.out.println( "You typed what was requested: " + yes + " ");
System.out.println( " You ignored polite instructions: " + no + " ");
}
}
Picture of Output