Created
February 5, 2018 22:43
-
-
Save viveknarang/4742a658b825f4511a5042b6bc8c43c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class CharMatching { | |
public static void main (String [] args) { | |
String userInput = ""; | |
char firstLetter = '-'; | |
userInput = "banana"; | |
firstLetter = 'b'; | |
if (userInput.charAt(0) == firstLetter) { | |
System.out.println("Found match: " + firstLetter); | |
} | |
else { | |
System.out.println("No match: " + firstLetter); | |
} | |
return; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment