mirror of
https://github.com/System-End/APCSA.git
synced 2026-04-19 22:15:15 +00:00
28 lines
797 B
Java
28 lines
797 B
Java
/* Lesson 7 Coding Activity Question 2 */
|
|
|
|
import java.util.Scanner;
|
|
|
|
public class U3_L7_Activity_Two {
|
|
|
|
public static void main(String[] args) {
|
|
Scanner scan = new Scanner(System.in);
|
|
System.out.println("Enter 2 strings:");
|
|
String a = scan.nextLine();
|
|
String b = scan.nextLine();
|
|
|
|
if (a.equals(b)) {
|
|
System.out.println("Equal!");
|
|
} else if (a.equalsIgnoreCase(b)) {
|
|
System.out.println("Different case");
|
|
} else if (
|
|
a.length() == b.length() &&
|
|
a
|
|
.substring(0, a.length() - 1)
|
|
.equals(b.substring(0, b.length() - 1))
|
|
) {
|
|
System.out.println("Close enough");
|
|
} else {
|
|
System.out.println("Try again");
|
|
}
|
|
}
|
|
}
|