CORE JAVA (FOR AUTOMATION TESTERS) – INTERVIEW QUESTIONS AND ANSWERS – PART 2


Go Back to: CORE JAVA (FOR AUTOMATION TESTERS) – INTERVIEW QUESTIONS AND ANSWERS – PART 1

16. What is abstraction?

Abstraction is a process of hiding the implementation details and showing only functionality to the user.

17. What is the difference between abstraction and encapsulation?

Abstraction hides the implementation details whereas encapsulation wraps code and data into a single unit.

18. What is abstract class?

A class that is declared as abstract is known as abstract class. It needs to be extended and its method implemented. It cannot be instantiated.

19. What is interface?

Interface is a blueprint of a class that have static constants and abstract methods.It can be used to achieve fully abstraction and multiple inheritance.

20. What is package?

A package is a group of similar type of classes interfaces and sub-packages. It provides access protection and removes naming collision.

21. What is Exception Handling?

Exception Handling is a mechanism to handle runtime errors.It is mainly used to handle checked exceptions.

22. What is the base class for Error and Exception?

Throwable.

23. Is it necessary that each try block must be followed by a catch block?

It is not necessary that each try block must be followed by a catch block. It should be followed by either a catch block OR a finally block. And whatever exceptions are likely to be thrown should be declared in the throws clause of the method.

24. What is the main difference between List and Set?

List can contain duplicate elements whereas Set contains only unique elements.

25. What is the difference main between HashSet and TreeSet?

HashSet maintains no order whereas TreeSet maintains ascending order.

26. What is the difference between Set and Map?

Set contains values only whereas Map contains key and values both.

27. What is the difference between HashSet and HashMap?

HashSet contains only values whereas HashMap contains entry(key,value). HashSet can be iterated but HashMap need to convert into Set to be iterated.

28. What is the difference between HashMap and TreeMap?

HashMap maintains no order but TreeMap maintains ascending order.

29. What is the difference between Collection and Collections?

Collection is an interface whereas Collections is a class. Collection interface provides normal functionality of data structure to List, Set and Queue. But, Collections class is to sort and synchronize collection elements.

30. What is the advantage of Properties file?

If you change the value in properties file, you don’t need to recompile the java class. So, it makes the application easy to manage.


Continue to: CORE JAVA (FOR AUTOMATION TESTERS) – INTERVIEW QUESTIONS AND ANSWERS – PART 3

Leave Comment

Your email address will not be published. Required fields are marked *

Looking for learning Framework Development from Scratch? Lookout for Detailed Framework Development videos on YouTube here -

https://www.youtube.com/automationtalks

Get the Framework code at Github Repo: https://github.com/prakashnarkhede?tab=repositories