Chapter 7 - Abstraction Flashcards

1
Q

Abstraction definition

A

Abstraction in Java is a fundamental Object-Oriented Programming (OOP) concept that involves simplifying complex systems by modeling real-world entities as classes with well-defined attributes and behaviors. It focuses on hiding the implementation details while exposing only the essential characteristics of an object. Abstraction allows developers to create a clear and generalized representation of objects, promoting modularity, reusability, and a higher level of understanding in software design. It is achieved through abstract classes, interfaces, and the definition of abstract methods that serve as contracts for concrete subclasses.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What java uses to implement Abstraction?

A

Abstract classes and methods

Interfaces

Method Overloading

Enums

Generics

Static methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is abstract classes

A

Abstract classes in Java serve as a blueprint for other classes. They allow you to define common methods and fields that will be shared among the concrete (non-abstract) subclasses while also providing a level of abstraction.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What can you say about instantiationg of abstract class?

A

Abstract classes cannot be instantiated on their own. You cannot create objects directly from an abstract class. Instead, they are meant to be extended by concrete subclasses that provide implementations for the abstract methods defined in the abstract class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What kind of methods does abstract class provide?

A

Abstract classes can have both concrete (with an implementation) and abstract methods (without an implementation). Abstract methods serve as placeholders that must be implemented by any concrete subclass that extends the abstract class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Can abstract class have a constructor?

A

Abstract classes can have constructors. When a concrete subclass is instantiated, the constructor of the abstract class is called before the constructor of the subclass.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

how interfaces support abstraction in Java?

A

Abstract Method Signatures

Interfaces declare methods without providing implementations. These methods are called “abstract methods” and serve as a contract that concrete classes must adhere to.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

I dont understand how method overloading supports abstraction

A

Method overloading is a feature in Java that allows a class to have multiple methods with the same name in the same class but with different parameter lists.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly