Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class HelloWorld{
- public static void main(String []args){
- A a = new A();
- B b = new B();
- check(a, b);
- }
- private static void check(A a, B b){
- if ( ( a.getX() != b.getY() && (a.getX() == null || b.getY() == null) )
- || ( a.getX() != null && !a.getX().equals(b.getY()) ) ) {
- System.out.println("IN");
- }
- }
- }
- class A{
- String x = "1";
- public String getX(){
- return this.x;
- }
- }
- class B{
- String y = "2";
- public String getY(){
- return this.y;
- }
- }
- // What I want to achieve:
- // pcs = null && mp = null -> skip
- // pcs = "1" && mp = "1" -> skip
- // pcs = null && mp = "1" -> enter
- // pcs = "1" && mp = null -> enter
- // pcs = "1" && mp = "2" -> enter
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement