Skip to content

Tag: oop

Creating multiple objects using the same instance

I just saw this tutorial creating multiple objects using the same instance by applying the DAO pattern and tried it in a simple console, but I always get this message java.lang.NullPointerException I’m now confused, as far as I know, a constructor can be used once only, and the object will be immutable.…

Why is casting in equals necessary?

I’m doing the Mooc course and it’s teaching us how to compare objects from made up classes like “Person” and see if they are equal to each other. They give us the following code: } For the equals method, I get that they compare using == first to check if it’s the same location. N…

What are transient dependencies?

I am studying the bnd introduction, and it says: ‘The advantage of Java was that it had found an elegant solution to the scourge of transient dependencies: Java interfaces.’ I also found the following quote: in the book ‘Professional Java for Web Applications’, but is there a simpler e…