Java 1 Vocabulary

 

Pixels:     Tiny dots on the computer screen.

 

Object:   An instance of a class. 

 

Class:      Provide methods and fields for objects.

 

Method:  Verb à Tells us the behaviors of an object.

 

Fields:     Adjective à The “state” of an object.

 

Statement:      A command followed by a semi-colon.

 

Command:      Calling an object’s method.

 

Comment:      A message for the human reader of the program.

 

        Types of Comments

                // insert comment here

                /*   YOU CAN WRITE HERE AS A COMMENT

                        these are comments

                        on several lines

                */ THIS WOULD NOT BE A COMMENT

 

 

/**

*        This is a “Java Doc” comment.

*

*/

 

Braces:    {     }    à Used to define the scope of a class or method.

 

Main Method: Driver of the program.  When you have a main method, you have an “application program”

 

 

Vocabulary from 9/19/05 – Class #4

 

Method definition:  public void

        (instead of public one might write private)

        (instead of void, one might write “int”, “String”)

 

Public:     It can be referred to by any other class.

 

Void:       The method returns NOTHING.

 

Instance:  An object of a class.

 

Executor: The object that’s calling the method.

        Example:         sam.fillBox(40, 40);

        The executor is:      sam

 

 

++++++++

We already have the Turtle class and it has six methods.

We want to improve the Turtle class à SPECIALIZATION

(SmartTurtle)

 

Super class:     Turtle

 

Sub class: SmartTurtle

 

Inherit:    The SmartTurtle is capable of doing everything a Turtle can do.  (Has the use of all Turtle methods.)

 

Header for the SmartTurtle

 

        Public class SmartTurtle extends Turtle

 

 

Vocabulary for Class #13 | October 14, 2005

 

Identifier:  Name WE CHOOSE for a method, variable, or class.

 

Keyword: PART OF THE JAVA PROGRAMMING LANGUAGE with a specific use/for a specific purpose.

 

You can never use a KEYWORD as an identifier.

 

Titlecase:  Only capitalizing the first letter of each word in an identifier, EXCEPT FOR THE FIRST WORD.

For example: move(), switchTo(), drawFiveSidedStar()

THE ONE EXCEPTION:     Class name ALWAYS begins with a capital letter.

 

Compiler:  Converts the SOURCE CODE (what we type) into bytecode.

 

Bytecode: The code the Java Virtual Machine uses to run the program.

 

Java Virtual Machine (JVM)

This INTERPRETS the bytecode!

 

Interprets

Converts it to machine code AND RUNS IT.

 

 

November 8, 2005 – Day 21

 

Method Call:                executor.methodName();

 

 

Method Header:          public returnType methodName(type param1, type param2)

 

 

Boolean:    Either true or false.

 

 

Robust:      Fail-proof.  Uses if statements to ensure that procedures can be carried out.

 

 

Condition: Either true or false.  Is evaluated inside of an if statement.

 

 

Overload:  When two or more methods have the same name with either:

a)     different number of parameters

b)    different type for the parameters

 

 

November 29, 2005 – Class #27

 

Precondition: What has to be true when a method begins execution, in order for the method to produce the expected result.

 

“!” (not) operator:   This will return the OPPOSITE value of what is being evaluated.  For example, if a slot is filled, the call to seesSlot() will return TRUE!  But if you write !seesSlot() à returns FALSE!

 

Return Statement: A return statement is the word “return” followed by a value or expression (condition) that is of the return type of the method.  You can have multiple return statements in a method.  The method ends when it encounters its first return statement.  If you want to exit a VOID method early, you can write “return;”

 

Boolean Method: A method that returns either true or false.


Class #28 – December 1, 2005

 

Action Method:       DO NOT return anything.  They do, however, change the state of an object.

 

Examples: sam.moveOn(), sue.putCD()

 

 

Query Method:        DO return something.  However, they should maintain state.  Boolean methods are typically “query” methods.

 

Assign:            To “assign” means to give a variable a value.  This is done using the “=” sign.

 

Variable:          Is of a specific “type” (ex. int, double, string, boolean, etc.)  These are used within classes and methods.

 

Boolean Variables:  A variable that is of the “boolean” type and therefore can only be equal to “true” or “false”.

Class #29 – December 5, 2005

 

Boolean Operators

“!” (not) à Means “opposite”. Takes one operand.

 

“&&” (AND) à Takes two operands; will only evaluate to true if they are BOTH TRUE.

Ex. a && b             ,               seesSlot() && seesCD()

 

“||” (OR) à Takes two operands; will evaluate to true so long as at least ONE operand is true.

Ex. a || b                  , seesCD() || stackHasCD()

 

Short Circuit:   The second operand of an && or || expression is not evaluated if the first operand BY ITSELF determines its truth or falseness.