Computer Programming 2 (PRELIMS)
Behaviors
Actions that an object can take
Import statement
By placing this, you can use all the classes that are in a package within any program o class definition
Abstract classes
Consider using this if you expect that classes that extend your abstract have many common methods or fields or require access modifiers other than public.
interfaces
Consider using this if you expect that unrelated classes would implement your interface
Abstract classes
Consider using this if you want to declare non-static or non-final fields.
Abstract classes
Consider using this if you want to share code among several closely related classes
interfaces
Consider using this if you want to specify the behavior of a particular data type, but not concerned about who implement its behavior
interfaces
Consider using this if you want to take advantage of multiple inheritance of type
False - Constructors can be overloaded too
Constructors cannot be overloaded (true or false)
equals() method
Instead of using == for comparison, use the ____ method
Constructor
It does not have a return type
Encapsulation
It groups instance variables and methods into a class
Encapsulation
It hides implementation details
Absolute value
Name: abs Description: ______
Ceiling
Name: ceil Description: ______
floor
Name: floor Description: ______
Maximum
Name: max Description: ______
Minimum
Name: min Description: ______
power
Name: pow Description: _____
Random Number
Name: random Description: ______
Rounding
Name: round Description: ______
Square root
Name: sqrt Description: ______
Reference
The address of the object's memory location
Class
The data type of an object is the name of its _____
Package
The name of the folder is the name of the ______
State
The values of an object's attributes give the object a ________
Variable is public
There are no restriction on where you can use its name
Local variables
Variables that ate not accessible from the rest of the class
True - it does not inherit any constructors from the base class
a derived class has its own constructors (true or false)
Static method
a method that can be invoked without using any object. It is invoked by using the class name instead
Inheritance
a program component that contains the heading for a number of public methods
mutator
a public method that changes the data stored in one (1) or more private instance variables
Accessor
a public method that returns data from a private instance variable
Constructors
a special method that is used to create and initialize an object
Polymorphism
ability of an object to take on many forms
false - abstract class CANNOT be instantiated but CAN be subclassed.
abstract class can be instantiated but cannot be subclassed (true or false)
Dynamic binding
allows many meanings to be associated to one method name
Polymorphism
allows you to make changes in the method definition for the derived classes
base class
also called superclass, parent class, and ancestor class.
derived class
also known as subclass, child class, and descendent class
Implements
an interface is used by another class through the _____ keyword
Static variables and Methods
belong to a class as a whole and not an individual object
Reference Types
class types are ____ whose variables hold references or memory addresses.
Package
collection of related classes and interfaces that have been grouped together into a folder
Method
collection of statements that are grouped together to perform an operation
Derived class
defined by adding instance variables and methods to an existing class.
Class
defines a kind of object; it is a blueprint for defining objects
UML Class Diagram
describes the structure of a class by displaying the class name (first row), variables (second row), and methods (third row).
true
different classes can implement the same interface (true or false)
Method
each behavior is defined by a piece of Java code
Inheritance
enables the use of existing class to define a new class
Base class
existing class that the derived class is built upon.
Information Hiding
is a mechanism for restricting access to some of the object's components
Argument
is the actual value that is passes when the method is invoked
Static variable
it can be public or private
Constructor
it can call methods within its class
Object
it has characteristics or attributes.
Interface
it should include comments that describe the methods
Variable is private
its name cannot be used to access it outside of the class definition
Parameter
list of variables in a method declaration
Abstract method
method that is declared as abstract and does not have an implementation
Method's signature
method's name and the number and types of its parameters
overloading
occurs when multiple methods have the same name within the same class
Encapsulation
process of combining data and actions into a single item.
Object- Oriented Programming
programming methodology that defines objects whose behaviors and interactions accomplish a given task.
Predefined Math class
provides a number of standard mathematical methods
Static variable
shared by all the objects of its class
Method definition is private
the method cannot be invoked within the definitions of methods in its class
Abstract method
this is written without braces, followed by a semicolon.
"new"
this keyword calls a constructor
Void
this keyword denotes that the method is not used to return a value
"this"
this keyword represents the object's name receiving the method call within a method definition.
Interface
used to specify methods that a class must implement. it contains headings for a number of public methods
Instance variables
variables declared outside the method, constructor, or any block.
Local Variables
variables declared within a method definition and are only visible to the methods n which they are declared.
Method is public
you can invoke it anywhere without restriction