how to use string variables with an if statement in java

Solutions on MaxInterview for how to use string variables with an if statement in java by the best coders in the world

showing results for - "how to use string variables with an if statement in java"
Fátima
11 Apr 2016
1String a = "Hello"
2
3if (a.equals("Hello") {
4	System.out.println("Variable A is Hello");
5} else {
6	System.out.println("Variable A is not hello :(");
7}
Chloé
05 Jan 2021
1String a = "Hello"
2
3if (a.equals("Hello") {
4	System.out.println("Variable A is Hello");
5} else {
6	System.out.println("Variable A is not hello :(");
7}