Identifier
a named pointer that explicitly identifies an object, class, method, or variable.
It allows programmers to refer to the item from other places in the program.
Rules state: the first character cannot be a number. No keywords, limits, or spaces
Primitive
the most basic data types valuable within the java language
They serve as the building blocks of data manipulation in Java
Have only one purpose, that of to contain pure, simple values of a particular kind.
Boolean
Byte
Char
Short
Long
Int
Float
Double
Byte
8-bit signed two’s complement integer
Min value is -128
Max value is inclusive 127
Default is 0
Used to save space in large arrays in the place of integers
Four times smaller than an integer
Integer
32 bit signed two’s complement integer
Min value is -2,147,483,648
Max value is 2,147,483,648 inclusive
Default data type for integral values unless there is a memory concern
Default value is 0
Long
64- bit signed two’s complement integer
Min value is -9,223,372,036,854,775,808 (quintillion)
Max value is 9,223,372,036,854,775,808 (quintillion)
Used when a wider range than int is needed
Default value is 0L
Double
A double precision 640 bit IEEE 754 floating point
Used as the default data type for decimal values
Should never be used for precise values such as currency
Default is 0.0d
Boolean
A data type that represents one bit of information
Only true or false
Used for simple flags that track true / false codnitions
Default value is false
Char
A single 16-bit unicode character
Minimum value is ‘\u0000’ aka 0
Maximum value is ‘\uffff’ aka 65,353 inclusive
Used to store any type of character.
Variable
provides a named storage location for a value that a program can manipulate.
Must be declared and can only contain data of a particular type.
Instance Variable
Non-static variables that are declared in a class outside any method, constructor, or block.
They are declared in classes and are created when an object of that class is created. Destroyed when that object is destroyed.
Access modifiers can be used for them.
The default access modifier of the class will be used if none are specified.
Parameter variables
Parameters allow us to pass information or instructions into functions and procedures.
Parameters are the names of the information that we want to use in a function or procedure.
The values passed in are called arguments.
Local variables
These variables are created when the block is entered or the function is entered or the function is called, and destroyed after exiting from the block or when the call returns from the function.
The scope of these variables exists only within the block in which the variable is declared. They can only be accessed within that block.
Method
a set code which is referred to by name and can be called at any point by using its name.
Can be described as a subprogram that acts on data and sometimes returns a value.
Each method has their own name (identifier)
Accessor
Accessor - a type of method used in java OOP that returns the value of a private instance (class) variable.
Getter method
Mutator
Mutator - a mutator method is used to control changes to an encapsulated instance (class) variable / state.
Setter method
Constructor
Constructor - a method that is an instance method (defined inside a class) that is invoked when an object of that class is created (by using the new keyword).
Object creation rule: when an object is created, one of the constructor method in the class must be invoked (to initialize the instance variables in the object).
Method vs Constructor
Signature
a part of the method declaration. The combination of the method name and the parameter list.
The reason for the emphasis on just the method name and parameter list is because of overloading methods that have the same name but accept different parameters.
Return value
a reserved keyword in java. CANNOT be used as an identifier.
Used to exit from a method with or without a value.
Can be used in methods in two ways
Methods returning a value: for methods that define a return type, return statement must be immediately followed by a return value.
Methods not returning a value: for methods that don’t return a value, return statement can be skipped.
Procedures versus functions
Procedures: do not return any value (void).
Functions: return a value
No method can return more than one value at a time in Java.
Access modifiers
Determine whether other classes can use a particular field or invoke a particular method.
A class may be declared with the modifier public, in which case that class is visible to all classes everywhere.
If a class has no modifier, it reverts to default condition and is visible only within its own package.
Three type of access modifiers:
Public
Protected
Private
Public
A class, method, field, or constructor that is declared public can be accessed from any other class.
Due to class inheritance, all public methods and variables of a class are inherited by its subclasses.
Private
Methods, variables, and constructors that are private can only be accessed within their declared class.
The most restrictive access level.
Classes cannot be private, but methods and variables in them can be.
Variables that are private can be accessed outside the class if the public getter methods are present in the class.
Using the private is the main way that an object encapsulates itself and participates in data hiding.
Protected
Can only be accessed by the superclasses’ subclasses in any class within the package of the protected members’ class.
Cannot be applied to all classes.
Access gives the subclass a chance to use the helper method or variable, while preventing an unrelated class from trying to use it.
Static
a non-access modifier in java which is applicable for blocks, variables, methods, and nested classes.
The member’s declaration must be preceded with the keyword static.
Used for any property that is common to all objects of that type.
Features of Modern Programming Languages that enable Internationalization
Use of common character sets among many platforms and languages, like UNICODE.
Platform independent high level languages (like java) enable code to run on many platforms.
Open-Source Movement
A movement that supports the use of open-source license for some or all software
Programmers who support the movement philosophy contribute to the open-source community by voluntarily writing and exchanging programming code for software development.
Open Source Advantages
Source code available, modifiable
Redistribute solutions
Use software in any way
Eliminates single point of failure
Democratic forum for action
No vendor lock-in
Open Source Disadvantages
No guarantee development will continue
Intellectual property (algorithms)
Support consistency
Proprietary Software Advantages
Predictable releases
Entity to hold responsible for bugs, errors, and updates
Consistent feature development
More stable framework
More consistent training options
Easier access to support
Proprietary Software Disadvantages
Higher start-up costs
Single company releasing patches
Vendor owns software