Groovy web console

subscribe to the feed Subscribe
to this
site

Prueba

Published 1 month ago by Anonymous
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
class Foo {
    private int id;
    private String name;

    public Foo(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public static boolean Compare(Object a, Object b){
        return a == b
    }
}
Foo a = new Foo(1, "hola");
Foo b = new Foo(1, "hola");
boolean res = Foo.Compare(a,b);
System.out.println("Comparando objetos: " + res);