Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- Copy and paste this code into a new class called 'cat', run it, does it work as it should?
- */
- import java.util.Scanner;
- public class cat
- {
- public static void main (String[] args){
- Scanner userInput=new Scanner(System.in);
- System.out.println("Enter an animal");
- String animal= userInput.next();
- if (animal=="cat"){
- System.out.println("you are a cat");
- }
- else{
- System.out.println("you are NOT a cat");
- }
- }
- }
Add Comment
Please, Sign In to add comment