Java
Object-Oriented Programming(OOP)
An Approach to creating and using models of physical or imagined objects
Class:
A Programmer-defined blueprint from which objects are created. A blueprint for how to create an instance of itself
Attributes: Characteristics of an Object
Behaviors: Actions that an object can perform
Object: An instance of the class
Instantiate: To call the constructor to create an object
Constructor: A block of code that has the same name as the class and tells the computer how to create a new object.
Reference Variable: A variable that points to an object
State: The Attributes represented by the object's instance variables
Camel Case:
Naming convention where the first letter of the first word is upper or lowercase, and the first letter of each additional word is uppercase
Calling Methods
Methods: A named set of instructions to perform a task
Parameter: A variable in the method that defines the type of value to receive when the method is called.
Begins with the name of the object, a dot operator, name of the method, and an argument within parentheses
Dot Operator: Used to call a method in a class
Argument: Value passed to a method when the method is called.
Types of Values
- Numbers: Integers, Floats, Doubles
- Text: String, Characters
- True or False: Boolean
Taken from CSA: Object-Oriented Programming, CSA: Creating Objects, and CSA: Calling Methods by Code.org
System.out.println("Hello");
char output = 'A';
for (int i = 0; i < 26; i++){
System.out.println(output);
output++;
}
static void test(){
System.out.println("Testing");
}
static void number(){
System.out.println("3");
}
public static void main(){
test();
number();
}
main();