Save
Upgrade to remove ads
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

OOP JAVA interview

TermDefinition
What is Object-Oriented Programming A way of designing real world entities as objects that bundle data and behavior, making code modular, reusable, and maintainable
What is a class in Java A user defined blueprint that defines attributes and methods used to create objects
What is an object in Java An instance of a class that holds real data and represents a specific entity
What are the four principles of OOP Encapsulation Inheritance Polymorphism and Abstraction
What is encapsulation Bundling data and methods together and restricting direct access using private fields and public methods
Why is encapsulation important It protects sensitive data and ensures controlled access through methods
What is abstraction Showing only essential functionality while hiding implementation details using abstract classes or interfaces
Why is abstraction useful It reduces complexity and lets users focus on what an object does instead of how it works
What is inheritance allows a class to reuse and extend the properties and behavior of another class
When should inheritance be used When there is a true is-a relationship between classes like a manager is an employee
What is polymorphism it means same method name, different behavior through overloading and overriding
What are the types of polymorphism Method overloading at compile time and method overriding at runtime
What is method overloading Multiple methods with the same name but different parameter lists in the same class
What is method overriding A subclass providing a new implementation of a parent class method
Difference between overloading and overriding Overloading is compile time in same class overriding is runtime in parent child classes
What is an abstract class A base class with shared state and behavior that can have both abstract and implemented methods
What is an interface a contract that defines methods a class must implement and allows multiple inheritance.
Difference between abstract class and interface Abstract class can have state and partial implementation interface defines only behavior and supports multiple implementation
Can a class implement multiple interfaces Yes a class can implement multiple interfaces
Can a class extend multiple classes No Java does not support multiple inheritance with classes
What is a constructor A special method that initializes an object when it is created
Can constructors be overloaded Yes constructors can have different parameter lists
What is this keyword Refers to the current object and is used to access instance members or resolve conflicts
What is super keyword Refers to the parent class and is used to call parent methods or constructors
What is static keyword Belongs to the class rather than instances and is shared across all objects
What is final keyword Prevents modification of variables methods or classes
What are access modifiers in Java Keywords that control visibility of classes methods and variables (ex: private, default, protected, and public)
What is private access modifier Accessible only within the same class
What is default access modifier Accessible only within the same package
What is protected access modifier Accessible within the same package and in subclasses outside the package
What is public access modifier Accessible from anywhere
What is association in OOP A general relationship where classes are connected but independent
What is aggregation in OOP A weak has a relationship where the child can exist independently of the parent
What is composition in OOP A strong has a relationship where the child depends on the parent for existence
Difference between aggregation and composition Aggregation allows independent existence while composition does not
What is dynamic method dispatch Runtime mechanism where the method to execute is decided based on the actual object
Why is polymorphism powerful It allows flexible and extensible code by enabling one interface to support multiple behaviors
What is composition over inheritance A design principle that prefers combining objects over inheriting to reduce coupling and increase flexibility
Why prefer composition over inheritance It provides more flexibility and allows behavior to change dynamically
What does == do in Java Checks if two references point to the same object
What does equals() method do Checks logical equality of object contents
What is hashing in Java Converting data into a fixed value for fast lookup
What is HashMap A collection that stores key value pairs using hashing for fast retrieval
What is hashCode method Generates a hash value used to store and retrieve objects efficiently
What is String immutability Strings cannot be changed after creation and any modification creates a new object
Why are strings immutable For security performance and thread safety
What is Java Collections Framework A set of interfaces and classes to store and manage groups of objects
What is List interface An ordered collection that allows duplicates
What is Set interface A collection that stores unique elements
What is Queue interface A collection that follows FIFO order
What is Map interface A collection that stores key value pairs with unique keys
What is ArrayList A dynamic array with fast access but slower insertions
What is LinkedList A linked structure with fast insertions but slower access
What is HashSet A collection that stores unique elements without order
What is TreeSet A collection that stores unique elements in sorted order
What is Comparable interface Defines natural ordering using compareTo method
What is Comparator interface Defines custom sorting logic
What is Big O notation A measure of algorithm performance based on input size
Why is Big O important It helps evaluate efficiency and scalability of code
Can we create object of abstract class No it cannot be instantiated directly and must be extended
What is compile time polymorphism Achieved using method overloading
What is runtime polymorphism Achieved using method overriding
What is static binding Method call is resolved at compile time
What is dynamic binding Method call is resolved at runtime based on object
When to use abstract class When you need shared state and partial implementation
When to use interface When you need a contract and multiple inheritance
What are types of constructors Default constructor and parameterized constructor
what is Default constructor A constructor with no parameters
what is Parameterized constructor A constructor that takes arguments to initialize values
Created by: user-2039634
 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards