This is one of the most frequently asked questions in the interview. Many interviewers will not leave this topic. So let's see the difference between them The main difference is that the Interfaces are implicitly abstract and cannot have implementation, whereas an abstract class can have a concrete class. Interface is implemented using the "implements" keyword. Abstract … [Read more...]
Difference between equals() and ==
Both equals() and '==' is used to check the equality of the objects but there is a significant amount of difference between equals() and '=='. The equals method is present in the java.lang.Object class and it is used to check the equivalence of the object (i.,e) to check if the content is equal whereas '==' is used to check if the actual object instances are same or not. … [Read more...]
Sort Objects in a ArrayList using Java Comparable Interface
In my previous post you would have learnt how to sort objects in a ArrayList using java comparator. Using the Comparable interface is almost the same as the previous, but here instead of a separate class for implementing the Comparator interface we can implement it in the same Employee Class by overriding the compareTo() method instead of the compare() method. Let see how the … [Read more...]
Sort Objects in a ArrayList using Java Comparator
Sorting the ArrayList or any Collection which has the primitive is easy. You can simply use the Sort method in Collection but thats not the case in real world situation you may be required to sort the objects based on the certain criteria. So first lets see how to sort the primitives. … [Read more...]
- « Previous Page
- 1
- …
- 9
- 10
- 11