public class If {
public static void main(String[] args) {
var myVar = "Emma";
int myInt = 1;
if (!(myVar == myInt)) {
System.out.println("Access granted.");
}
}
}
I am learning Java now. What I should do now is to print out 'true'.
First, I tried declaring the var and int. Then I put ! operator to change 'false' into 'true'.
I thought this would work, but it doesn't. Why doesn't it work? Shouldn't I declare anything when I use the if statement? Thank you
varin Java??varis not used to declare variables in Java.