equals not java code example
Example 1: java not equal to
if(5 != 4)
return true;
Example 2: equals example java
import java.util.Scanner;
public class YourProjectName {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
String password1;
String password2;
String msg;
System.out.println("Enter password: ");
password1 = keyboard.nextLine();
System.out.println("Repeat password: ");
password2 = keyboard.nextLine();
if (password1.equals(password2)) {
msg = "Password matching!";
} else {
msg = "Password not match";
}
System.out.println(msg);
}
}
Example 3: not equal java
int i = 2;
if (i != 3) {}
String s = "a";
if(!s.equals("b")) {}