jeudi 1 août 2019

If statement that affects another method in another class

How do I setup an if statement that affects another method in another class in JAVA. So if a is 10 in Class A, than Class B will return true

Class A:

public void Hey(){
int a = 10;
if(a == 1){
System.out.println("one");
}else if(a == 10){
System.out.println("ten");
}
}

Class B:

A Obj = new A();

if(Obj.Hey()./*WHAT DO I PUT HERE*/){
    System.out.println("true");
}else{
    System.out.println("false");

}

Aucun commentaire:

Enregistrer un commentaire