Creating Classes (Terminology) Flashcards Preview

Java 1 > Creating Classes (Terminology) > Flashcards

Flashcards in Creating Classes (Terminology) Deck (11)
Loading flashcards...
1

class vs object?

Class: The blueprint
Object: The product of the blueprint (house)

2

toString method?


Automatically is used when a programmer writes the following in their driver: print() and println()
-The toString() method by default is limited so it is recommended that each created class have a custom toString() method so we can control the output when our class is called on.

3

toString method?


toString() method is Automatically used when a programmer writes the following in their driver: print() and println()
-The toString() method by default has limitations, so it is recommended that each class we create have a custom toString() method so we can control the output when our class methods are called on.
nameofObject.nameOfMethod();

4

class vs object?

Class: is the blue print of the object-- Basically the Class is the instruction that takes place to create an object?
so class = blueprints

Object:
object= house built out of those blueprints.

5

toString method?

= The format that our output will print to.

toString() method is Automatically used when a programmer writes the following in their driver: print() and Syste,.out.println()
-The toString() method by default has limitations, so it is recommended that each class we create have a custom toString() method so we can control the output when our class methods are called on.
nameofObject.nameOfMethod();

6

Driver/ Application?

The driver is what runs and produces output to the user. it is what the user interacts with.
while the classes are written in another area and are called on.
Contains the () main method.

7

what is an Accessor?

The Accessor gives the driver access to private object values in a secure way so that the driver can not alter the private object.
a method that is written in the class (portion of code) & uses "Public" so that the method can be called on via the driver/ program code.

8

What is the code format of an Accessor?
can you give an example?

Format:
Public returnTypeLikeString getNewObjectName ()
{ return objectThatIsPrivate; }
Example:
public int getPhoneNumber ( )
{ return phoneNumber; }
^^^^^^^^^^^^^this is a private object within the class.

9

What is a Method? examples?

Method = class code written where a method name is associated with code (does something).
Examples:
-mutators, Accessors, constructor ect.

10

what is a Mutator?
Example?

Mutator: allows another class to change the value of data.
example:
public void setParts(float cparts)
{ if (cparts > 0)
parts = cparts; }
^ whatever is in the { } is the security check so that bad data cant be assigned when the data is being changed.

11

what does the return type: void do?

void: does not return data, instead it does work. example: a Mutator is used with void to change a value in a class.