tree, person, book, anything. • The blueprint for an Object is a Class. • Classes have fields. A field is what the Object will "know" (more on Types of fields later). • Classes have constructors. It can have a default constructor with no parameters, and/or many with parameters. • Classes have methods. Methods can be mutators (change information) or accessors (get information)
25, "Bronto Crane Operator", 33000.0); • Creating a new Employee with the name "Fred" and the surname "Flintstone". • His age is 25, he works as a Bronto Crane Operator, and he makes $33000.00 per year. How does Java remember this?
storing data in. • When you create a variable or object, Java stores information in a slot or slots. • Then, when you want that information again, you call the variable or method. ◦ Java finds the slot it's stored in and returns its' contents to you.
— reference types hold the memory location (#667Fddee12134, or something similar) • When compared (==), primitive type's value is compared. Reference type's location is compared. • The Object's contents is one line (the memory location). For that reason, only something one line can fit there (so no Strings, can be more than one line!)
Box, you get a key. That key is like an Object's memory address. • If you open your P.O. Box, you can get the contents of it. Memory Location ("Key") Contents
using dot-notation. • We access or modify information associated with the Object using methods. Employee FF = new Employee("Fred", "Flintstone", 25, "Bronto Crane Operator", 33000.0); FF.getName(); // => "Fred" When you do this, you're requesting information. Or, you're modifying the information that is there.