Unit 3: Methods/Functions Continued Flashcards
An Object is a combination of _____ and ______
Data, procedures
Data in an object are known as…
attributes, fields, data members, or instance variables. An object stores data in its fields
Procedures in an object are known as…
Methods, member-functions, member-methods, or method-members
The first step in creating an object is to outline and define the characteristics of that object, with the aid of a _______
Class
Define: Class
A program structure that allows a programmer to define the characteristics of an object that needs to be created
A class may contain ______ only or ________ only
Methods, attributes
What does object oriented programming (OOP) do?
Allows creating ‘objects’ and makes a program a cluster of interacting objects
Why the object-oriented approach?
Appropriate for programs that model the real world, accelerate system development, simplify systems integration and standardization, suitable for building huge applications
True or False: class is a keyword
True
Define: Access modifier
A Java keyword that indicates how a field, method, or class can be accessed in a program
What are the three Java access modifiers:
Protected, public, private
If there is no access modifier used, it is considered to have a _____ modifier
Default
Define: public (access modifier)
Accessible from any class or package in the Java program
Define: private (access modifier)
Accessible only within the class-definition. Outside a class, the private data-members and methods of that class can be accessed indirectly by the public methods of the same class via its objects
Define: protected (access modifier)
Allows for the data-members, methods, and constructors accessible in the same package and subclasses
Define: Default (access modifier)
Access from the same class and same package only
Classes that need to be used by other classes are typically made __________
Public
Access modifier for any outer-class can be _____. Only inner-class can have ______ access modifier
Public, private
True or False: In Java, an object is a reference-variable of a defined class type, also referred to as an instance of a class
True