Classes and Objects 1 Flashcards
(14 cards)
What are the 4 basic concepts that support all programming languages?
- Calculation: constants, variables, operators, expressions
- Selection: if-else, switch, ?
- Iteration: while, do, for
- Abstraction: The process of creating self-contained units of software that allows the solution to be parameterized and therefore more general purpose
What is the definition of abstraction in object oriented languages?
Abstraction in Object Oriented (OO) languages is provided through an Abstract Data Type (ADT), which contains data and functions that operate on data
Example: class
What is the definition of class?
A fundamental unit of abstraction that represents an “entity” that is part of a problem
What is the definition of Objects?
Objects are an instance of a class that contain state, or dynamic information
What is an instance?
An instance is an object that exists in your code
What are the object oriented features?
- Data Abstraction
- Encapsulation
- Information Hiding
- Delegation
- Inheritance
- Polymorphism
What is the definition of data abstraction?
The technique of creating new data types that are well suited to an application by defining new classes.
Class example: circle in the drawing pad
What is the definition of encapsulation?
The ability to group data (attributes) and methods that manipulate the data to a single entity though defining a class
What is an instance variable?
A property or attribute that is unique to each instance (object) of a class
What is a local variable?
A local variable is a variable declared inside the method
What is null?
The Java keyword for “no object here”. Null objects can’t be “accessed” to get variables or methods, or used in any way
What is instantiate?
To create an object of a class
What is new?
Directs the JVM to allocate memory for an object, or instantiate it
When is an object a candidate for Java Automatic Garbage Collection?
When the object doesn’t have a valid reference, hence cannot be used in future