Tutorial: Creating Objects
Write an Expression
Expression- specific coding that when read by the computer it produces a value
Format for an expression
Operator Director/Package Object Created/Name of Class
Ex) New Chapter 1 Terrarium( )
Operator- Denotes creating a new Object
New = A Keyword in Java telling the computer to create a new instance of a class definition
Final Expression
new chapter1.Terrarium( )
Creates Instance of the Terrarium Class
Basic Structure of Java Source Code
Package Declaration- Packaging is a way of grouping classes in Java. This indicates what class the package belongs to and is the first line of the source code.
Package = Keyword in Java
Class Header- start of the class definition.
Ex) public class indentifier
Public = Access Control Modifier and keyword in Java
Access control Modifier- controls what parts of the program can access that file.
Class Body- second part of the class definition
Ex) {
Properties Defined
Capabilities Defined
}
{ }- Denote the beginning and end of the Class Body
Putting it all Together
Ex) package identifier ;
public class indentifier {
Properties defined
Capabilities defined
}
What is going on in the Computer?
-Problem Domain- relevant to the problem
-Initial Conceptual Model- model of the Problem Domain/ Solution to the problem
-Iteravitve Refinement Model
-Program Code (Executable Model)-final solution to the problem
-Compilation- translation so it can be read by the machine
-Machine Excecutable