You are on page 1of 2

Java OOPS Interview Questions

1. Name the principles of OOP and tell about each.


2. Give the definition of �class�.
3. What is a class field / attribute?
4. How to organize access to the fields of the class?
5. Give the definition of �constructor�.
6. What is the difference between default constructors, copying and constructor
with parameters?
7. What modifications of the access level do you know, tell us about each of them.
8. Tell us about the features of the class with a single closed constructor.
9. What do the keywords �this�, �super� say, where and how can they be used?
10. Give the definition of �method�.
11. What is a method signature?
12. What methods are called overloaded?
13. Can non-static methods overload static?
14. Tell about redefinition of methods.
15. Can a method take a different number of parameters (variable length arguments)?

16. Is it possible to narrow the access level / return type when redefining the
method?
17. How to get access to the overridden methods of the parent class?
18. What transformations are called descending and ascending?
19. How is overriding different from overloading?
20. Where can I initialize static / non-static fields?
21. Why is the instanceof operator needed?
22. Why do we need and what are the initialization blocks?
23. What is the order of calling constructors and initialization blocks of two
classes: a descendant and its ancestor?
24. Where and what is the abstract modifier used for?
25. Is it possible to declare a method abstract and static at the same time?
26. What does the static keyword mean?
27. To which Java constructs is the static modifier applicable?
28. What happens if an exception occurs in the static code block?
29. Is it possible to overload the static method?
30. What is a static class, what are the features of its use?
31. What are the features of initialization of final static variables?
32. How does the static modifier affect a class / method / field?
33. What does the final keyword mean?
34. Give the definition of �interface�.
35. What modifiers have fields and methods of interfaces by default?
36. Why can�t I declare an interface method with a final or static modifier?
37. What types of classes are in java (nested � etc.)
38. What are the features of creating nested classes: simple and static.
39. What do you know about nested classes, why are they used? Classification, use
cases, violation of encapsulation.
40. What is the difference between nested and inner classes?
41. Which classes are called anonymous?
42. How from the nested class to get access to the field of the outer class?
43. How can I access the local variable of a method from an anonymous class
declared in the body of this method? Are there any restrictions for such a
variable?
44. How is any custom class related to the Object class?
45. Tell us about each of the methods of the Object class.
46. ??What is the equals () method. How it differs from the operation ==.
47. If you want to override equals (), which conditions must be satisfied for the
overridden method?
48. If equals () is overridden, are there any other methods that should be
overridden?
49. What are the features of the hashCode and equals methods? How are the hashCode
and equals methods implemented in the Object class? What rules and conventions
exist to implement these methods? When do they apply?
50. Which method returns a string representation of an object?
51. What happens if you redefine equals without overriding hashCode? What problems
may arise?
52. Are there any recommendations on which fields should be used when calculating
hashCode?
53. What do you think, will there be any problems if an object that is used as a
key in a hashMap has a field that participates in the definition of hashCode?
54. What is the difference between an abstract class and an interface, in which
cases what will you use?
55. Is it possible to access private class variables and, if so, how?
56. What is volatile and transient? For what and in what cases it would be possible
to use default?
57. Expanding modifiers for inheritance, overriding and hiding methods. If the
parent class has a method declared as private, can the heir expand its visibility?
And if protected? And narrow visibility?
58. Does it make sense to declare the method private final?
59. What are the features of the initialization of final variables?
60. What happens if a single class constructor is declared final?
61. What is finalize? Why is it needed? What can you tell about the garbage
collector and the algorithms of its work.
62. Why is the clone method declared protected? What is needed to implement
cloning?

You might also like