import java.util.Scanner;
public class systemsimulate {
public static void main(String[] args) {
String y,ynext;
Scanner scm=new Scanner(System.in);
System.out.println("enter the initial state");
y=scm.next();
System.out.println("enter the disturbance");
String d=scm.next();
if(y=="A" && d=="1"){
System.out.println("A");
}
}
}
when i run this program it doesnt print A ispite og giving valid input parameters.why the condition is not being evaluated.can anyone tell me the error
What I have tried:
i tried using char instead of string format but it is still not working.i also displayed indivsual y and d .it got displayed but it is not performing code in if loop