Class as the Basis of all Computation Flashcards
define software object
an object that is created while writing a java program. characteristics are data members, and behaviour are member functions
define class
a class is a blueprint or template for objects that describes characteristics and behaviourwh
why is object instance of a class
an object includes the instance variables described within the class
use of new keyword
to allocate space in the dynamic memory for storage of data and functions
define instantiation
when an object of a class is created
ways of programming by using a class
- with main function
- without main function
contents of class
- external wrapper (class declaration)
- internal contents
parts of internal contents in class
- access specifiers
- instance variable
- local variable
- class variable
5 constructors - member methods
elements of external wrapper
- class
- class name
define access specifiers
terms used to specify the extent of usage of the class members in the program
features of instance variables
- variables declared within the class but outside member methods
- same set of instance variables can be used for all objects of the class
- instance variables are fields of an object
- instance variables belonging to different objects have different values
class variables/static variables and instance variables difference
instance: no static keyword, variables are the individual copies of each object
static: static keyword, variables are a common copy for each object
features of local variable
- declared within the body of a method
- can never be static
- scope is limited within curly braces of the method in which they are declared
- they are not given initial default values
features of member methods
- also called member functions
- declared public or private
- basically used to handle class instance variables
- may be parameterized to return outcome
define static data member
a static data member is a class variable which is global in the class and used commonly by all the objects of that class type