Java Class Terminology Flashcards

learn the 5 parts of a class. constructor, mutator, accessor, helping methods, toString

1
Q

Constructor?

A

Allows a program/driver to create objects from the class (instantiate an object). Parameters() are optional.

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

Accessor? also know as a?

A

allows a driver/application to see the value of a private data members (variables) that is inside the class. known as: a getter (accessor).

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

Mutator? also known as?

A

allows a driver/application to alter the data value of a private variable that is within the class. also known as: a setter.

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

helping method? example?

A

Can be used within just the class by using a private access modifier we can also have a helping method that is used by the driver so that the results of private objects can be returned. example: public float calcTotal() { return (privateVariable + 2ndPrivateVariable); }

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

toString?

A

written within the class so that a driver can display a certain format pre determined. routinely displays data.

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

UML?

A

UML = Unified Modeling Language represents a specific class in visual manner. *We never add instance variables that are not in the UML diagram.

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

instantiate?

A

instantiate: when an object is created. Done within a class. the object inherits generic values from the class it is created in.

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

what are data members called?

A

data members: same as instantiated variables / fields.

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

what is a Method?

A

Method: Created within a class. set of instructions that makes an operation occur. (a formula that is contained within a word or object name).

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

what are the 5 parts that make up a method?

A

parts of method: 1- modifier 2- return type 3- method name 4- method signature 5- parameter

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

what is a method modifier?

A

method modifier: The access type of either public or private

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

what is a method return type?

A

method return type: the data type returned= char, int, double, float.

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

what is a method name?

A

method name: name i choose for the method to be called on later.

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

what is a method signature?

A

method signature: method name and parameter list combined

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

what is a method parameter?

A

method parameter: a placeholder.. when a method is invoked(used) a value is passed called the argument.

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

what is it called when a program or driver contains the main() method?

A

application -uses classes within their programs.

17
Q

is input generated from: drivers, classes or applications

A

applications only.

18
Q

user defined class?

A

class that is not part of the java library. was built by a programmer and does not contain input or output.

19
Q

instance data?

A

non static data that can change values. usually declared at the top of a class.

20
Q

local data items?

A

data items declared within class methods such as within a constructor, mutator or accessor.

21
Q

describe what overriding is?

A

when an already defined method is overwritten with data that is custom or slightly different. **often used with toString() to produce custom output.

22
Q

equals method used?

A

determines if two objects from the same class are the same. is a boolean of true or false and can be defined within a class.

23
Q

how new objects are instantiated inside a driver?

A

the class name is used before the instantiated object name (new object) so that the constructor within the class can form the instantiated object the correct way. data is entered inside ().

24
Q

what is the format of a mutator?

A

ObjectName.MutatorMethod (Arguments needed) example: customerName = in.nextLine(); System.out.print(“enter in the name”) ObjectJulie.setName (customerName);

25
Q

what is a shortcut in code for the driver that will use the toString method with an object?

A

System.out.print(object); ^ is the same as System.out.print(object.toString());

26
Q

Describe how a Method is set up.
visialize the different parts. How is it “built”?

A