Java and Netbeans Lesson 2

2. Console Input and Output - String - String Compare - Conditional

package project2;
import java.util.Scanner;

public class Project2 {

      public static void main(String[] args) {
             String UserInput;
             System.out.print("Enter your name: ");
             Scanner s = new Scanner(System.in);
             UserInput = s.nextLine();
             System.out.println("Hello "+UserInput);
             int x;
             x=UserInput.compareTo("Jim");
             if(x==0){
                     System.out.println("Great Name");
             }else{
                     System.out.println("I guess that's on OK name!");
             }
      }
}