Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Scratchpad {
- public static void main(String[] args) {
- Bar o = new Bar();
- System.out.println(o.equals(o));
- }
- }
- class Foo {
- public boolean equals(Object o) {
- return this == o;
- }
- }
- class Bar extends Foo{
- }
- class Bar extends Foo{
- public boolean equals(Bar b){
- return false;
- }
- }
- public final boolean equals(Object o) {
- return o.getClass() == Foo.class && this == o;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement