Creating Classes (Terminology) Flashcards

1
Q

class vs object?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

toString method?

A
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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

toString method?

A
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();
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

class vs object?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

toString method?

A

= 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();
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Driver/ Application?

A
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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is an Accessor?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the code format of an Accessor?

can you give an example?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a Method? examples?

A
Method = class code written where a method name is associated with code (does something).
Examples:
-mutators, Accessors, constructor ect.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what is a Mutator?

Example?

A
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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what does the return type: void do?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly