1. How can a subclass call a method or a constructor defined in a superclass?
Use the following syntax: super.myMethod(); To call a constructor of the superclass, just write super(); in the first line of the subclass’s constructor.
2. What’s the difference between a queue and a stack?
Stacks works by last-in-first-out rule (LIFO), while queues use the FIFO rule.
3. You can create an abstract class that contains only abstract methods. On the other hand, you can create an interface that declares the same methods. So can you use abstract classes instead of interfaces?
Sometimes. But your class may be a descendent of another class and in this case the interface is your only option.
4. What comes to mind when you hear about a young generation in Java?
Garbage collection.
5. What comes to mind when someone mentions a shallow copy in Java?
Object cloning.
6. If you’re overriding the method equals() of an object, which other method you might also consider?
hashCode()
Use the following syntax: super.myMethod(); To call a constructor of the superclass, just write super(); in the first line of the subclass’s constructor.
2. What’s the difference between a queue and a stack?
Stacks works by last-in-first-out rule (LIFO), while queues use the FIFO rule.
3. You can create an abstract class that contains only abstract methods. On the other hand, you can create an interface that declares the same methods. So can you use abstract classes instead of interfaces?
Sometimes. But your class may be a descendent of another class and in this case the interface is your only option.
4. What comes to mind when you hear about a young generation in Java?
Garbage collection.
5. What comes to mind when someone mentions a shallow copy in Java?
Object cloning.
6. If you’re overriding the method equals() of an object, which other method you might also consider?
hashCode()
