java if statement string code example
Example 1: 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 :(");
}
Example 2: how to use the if sentence in the string
public boolean contains(CharSequence str)
Example 3: if statement with string java
if (var.equals("text"))