More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Ans. Abstract classes can have both abstract methods ( method declarations ) as well as concrete methods ( inherited to the derived classes ) whereas Interfaces can only have abstract methods ( method declarations ).
A class can extend single abstract class whereas it can implement multiple interfaces.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Inner join is the intersection of two tables on the condition defined by the where clause i.e will get records from both tables matched by a column.
Outer join is the union of two tables i.e will get all records from both tables and will put null in the columns where related records are not present.
Left Outer join is the left union of two tables i.e all records from the table on the left and values from the right table for related records else null for the columns from right table.
Right Outer join is the right union of two tables i.e all records from the table on the right and values from the left table for related records else null for the columns from left table.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Checked exceptions are the exceptions for which compiler throws an errors if they are not checked whereas unchecked exceptions are caught during run time only and hence can't be checked.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Iterators in java are used to iterate over the Collection objects.
Fail-Fast iterators immediately throw ConcurrentModificationException if there is any addition, removal or updation of any element.
Fail-Safe iterators don't throw any exception if a collection is structurally modified while iterating over it. This is because, they operate on the clone of the collection and not on the original collection.
Help us improve. Please let us know the company, where you were asked this question :
Ans. The purpose of comparator interface is to compare objects of the same class to identify the sorting order. Sorted Collection Classes ( TreeSet, TreeMap ) have been designed such to look for this method to identify the sorting order, that is why class need to implement Comparator interface to qualify its objects to be part of Sorted Collections.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Comparable interface is used for single sequence sorting i.e.sorting the objects based on single data member where as comparator interface is used to sort the object based on multiple data members.
Help us improve. Please let us know the company, where you were asked this question :
Ans. A finally block of code always executes, whether or not an exception has occurred.The only time finally won't be called is if you call System.exit() or if the JVM crashes first.
Help us improve. Please let us know the company, where you were asked this question :
Ans. It is used to sort collections and arrays of objects using the collections.sort() and java.utils. The objects of the class implementing the Comparable interface can be ordered.
Help us improve. Please let us know the company, where you were asked this question :
Very Frequently asked. Favorite question in walkins and telephonic interviews. Usually among first few questions. Asked in different variants. Must know for intermediate and expert professionals.Among Top 10 frequently asked questions.
Q10. What is rule regarding overriding equals and hashCode method ?
Ans. Fail Safe systems are tolerant systems that continue processing even if they sense any problem. the objective here is to continue with the processing even if there are some problems instead of completely shutting it down. Example could be to catch an exception and still letting it complete with partial results.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Fail fast systems are intolerant systems that fails at the first instance of smelling any problem. The objective here is to break the system instead of continuing with the possibly flawed processing. Example could be breaking the processing upon an exception.
Help us improve. Please let us know the company, where you were asked this question :