// Zorah Fung, CSE 142 // An example of using several String methods import java.util.*; public class StringExample { public static void main(String[] args) { Scanner console = new Scanner(System.in); System.out.print("What is your full name? "); String name = console.nextLine(); int space = name.indexOf(" "); String firstName = name.substring(0, space); String theRestOfMyName = name.substring(space + 1); System.out.print("Hello, " + firstName + "! What is your password? "); String password = console.next(); String realPassword = "IWantToGetIntoCS"; if (password.equals(realPassword) && firstName.equalsIgnoreCase("Derek")) { System.out.println("Access Granted!"); } else { System.out.println("Access Denied! Loser"); } } }