how to use string variables with an if statement in java
String a = "Hello"
if (a.equals("Hello") {
System.out.println("Variable A is Hello");
} else {
System.out.println("Variable A is not hello :(");
}
how to use string variables with an if statement in java
String a = "Hello"
if (a.equals("Hello") {
System.out.println("Variable A is Hello");
} else {
System.out.println("Variable A is not hello :(");
}
how to use the if sentence in the string
String str = "Game of Thrones";
//This will print "true" because "Game" is present in the given String
System.out.println(str.contains("Game"));
/* This will print "false" because "aGme" is not present, the characters
* must be present in the same sequence as specified in the contains method
*/
System.out.println(str.contains("aGme"));
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us