Objects
Notes & Homework (Scroll Down or use TOC to Find HW)
Object Oriented Programming
OOP is a typ of coding paradigm that uses objects classes and methods as the main components to the paradigm. Classes act as templates while objects act as instances of the templates. Methods represent the functions each object/class can execute.
Objects can contain data members, methods, constructors, interfaces, nested classes. Variables act as data members/attributes of an object just as an orange represents vitamin C or calorie count.
Declaring methods has 6 parts to it. First is the Access Modifier which is public, protected, private, or default and these defines the level of access code can have to certain methods. Return types are the return types of the data. The next is method name which specifies the name of the method and follows traditional camel case naming conventions. Next is parameter list which is the list of parameters that must be passed through when calling a method and are used as values that the method uses. The body of method is the actual logic of the method and what is executed when it is called. Exceptions are the specific exceptions that a method may need to throw if any unexpected errors happen. This allows errors to compile in Java code.
Reuse, optimization, organization, object reference required to call an object's method. Must call method with arguments.
Homework: Implement Variables into the Code
See here to find homework