Objects First With Java 5E – Chapter 01 Notes

Objects are categorized by class.

Objects may be categorized as – and a class describes, in an abstract way – all objects of a particular kind.

ie ; Car is the class and ford focus an object of the Car class.

The word “instance” is synonymous with the word “object”, and will be used interchangeably.

ie : ford focus is an instance of the Car class

Convention : name of a class should start with a capital letter and name of an object or instance of that class should start with a lowercase letter.

ie : fordFocus is an object instance of the Car class

Methods represent operations that can be used to manipulate objects. We communicate with objects by calling or invoking methods

The word “function” is synonymous with the word “method” and will be used interchangeably.

Sometimes methods require parameters to provide additional information for a task.

The top line of code for a method is the header and is known as the signature for that method. in this case void setCarType(String newCarType) is the method signature.

void setCarType(String newCarType)
    {
        carType = newCarType;
    }

Parameters have data types. Data types define what type of data will be passed into method as parameters.

ie : int, String, double, boolean

There are two kinds of data type : primitive data type and object data type.

A variable is created and the primitive data type is stored directly in that variable

An objects exists and a reference to that object is stored in the variable to make that variable an Object data type

You may create multiple instances of objects of a single class.

Obects have state. State is represented by values in fields that define the object. All the data values together in an objects fields are referred to as an object’s state.

The word “field” is synonymous with the word “instance variable” and is used interchangeably.

Objects of the same class have the same number, name and type of fields.

Objects of the same class have the same number, name, and type of methods.

The following is an example of creating a new object of the Car class and calling on a method of that object.

Car car1 = new Car();
car1.setCarType();

On the first line we create the car1 object by first declaring it and assigning it to new Car object.  On the second line we call a method on that object by first typing the object name followed by a dot, followed by the method name, followed by a parameter list.

Parenthesis indicate a parameter list. Anything within the parenthesis is considered part of the parameter list.

All java statements end with a semi colon ;

Method Calling. Objects can communicate by calling eachothers methods.

The source code of a class determines the structure and behavior (the fields and the methods)of each of the objects of that class.

Methods may return infomation about an object via a return value.

Return type is that data type that is returned as a result of calling a method

The return type is specified in the signature of the method. If a void return type is specified then the method does not have a return statement and does not return any data.

public String getCarType()
    {
        return carType;
    }

In the previous code we see String specified as the return type in the method signature. We also see the return statement in the body of the method.

Objects can be used as parameters as long as the object class is specified as the object data type in the method header.

public void addCar(Car newCar)
    {
        carList.add(newCar);
    }

Exercise Questions

1.14 How do you think the House class draws the picture?

1.14 The House class calls the draw() method that in turn creates instances of the objects needed to form the picture.

1.33 Write the signature for a method named send that has one parameter of type String, and it does not return a value.

public void send(String msg)

1.34 Write a signature for a method named average that has two parameters both of type int, and returns an int value.

public int average(int firstInt, int secondInt)
Posted in java, object oriented programming, programming | Leave a comment

PDFescape – Edit PDFs Online

pdfe_hd

Your receive an email, ‘Please fill out and return this form by specified date’. Attached is a PDF.  Great. All I have to do is print it and fill it out, fax it, or scan it as a PDF and email it back. Too bad I’m sitting in a coffee shop nowhere near a printer, scanner or fax machine.

PDFescape was simple. You upload your PDF and simply click to create a text box where you want to fill in information. Text is laid over the original PDF document. I just places x’s over check boxes and filled in fields as required. You do need to sign up to save your edited PDF;  sign up requires an email address and password, they do not request additional address information.

You can go premium and get no adds and more storage for $20 a year, but for as much as I would use it, not likely.

https://www.pdfescape.com/

Posted in Productivity, Uncategorized | Tagged , , , , , | Leave a comment

Unity3D Skybox with Terragen2 Generated Images – Part 2

1. Start Unity and load project

2. Create Unity Skybox Material

(a) click on the menu Assets -> Create -> Material and name the new material SkyBox

Unity_Create_Skybox_Material

(b) Select the SkyBox material from assets and in the inspector click the Shader button and select RenderFX -> Skybox

(b) In Assets Select the SkyBox material and in the Inspector click the Shader button and select RenderFX -> Skybox

Unity_Create_Skybox_Material_02

3. Make sure all the Terragen2 SkyBox images Wrap Mode are set to Clamp

(a) In Assets locate and Select the SkyBox images

(b) In the inspector click the Wrap Mode button and  select clamp

Unity_wrap_mode_clamp

4. Add Terragen2 Skybox images to the Unity SkyBox material.

(a) Select the SkyBox material in Assets

(b) Click and drag SkyBox-Front image from Assets to the Front slot of the SkyBox material in the inspector.

(b) Click and drag SkyBox images from Assets to corresponding slots of the SkyBox material in the inspector.

Unity_drag_and_drop_corresponding_images

5. Apply Skybox Material in Render Settings

(a) From the menu click Edit -> Render Settings to open the render setting in the inspector

Unity_render_settings

(b) Drag your Skybox material from Assets to Skybox Material Slot in the inspector for Render Settings

Unity_drag_and_drop_SkyBox_render_settings

Posted in 3D, Terragen, Uncategorized, Unity3D | Tagged | Leave a comment