Java Questions
Java Questions
OOP Questions
These questions apply not only to Java, but object oriented
languages in general.
2. Explain inheritance
Making one object the child of another gives the child all
properties and methods (with respect to access modifiers) of
its parent and ancestors. That is inheritance — it is used to
achieve code reusability and polymorphism. In Java, as in
most modern languages, an object can only have one parent —
Java does not support multiple inheritance. Inheritance
creates tight coupling between the parent and its children,
which is why dependency injection is often a preferred
alternative, as it allows related pieces of code to be decoupled.
3. Explain polymorphism
Post
* Id: Long
* Likes: Integer
Thread
* Id: Long
* Post: ForeignKey<Post>
Java Questions
6. What can you tell me about memory management and
garbage collection in Java?
Overriding happens in a subclass. Overloading happens in
the same class.
instance of the parent/superclass.
21. What are some ways that you could sort a collection?
or
Endless Loop
26. Write a Java program to check, if a number is prime.
Primes
52. What is your dream job? What’s your perfect work day
like?
What does the career path look like for this role?