5.4 Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Method & Method Signature

A

textbook definiton:
A signature includes the name of the method, as well as its parameters, their number and types. Return types are not considered part of the signature.

A method is a set of code which is referred to by name and can be called (invoked) at any point in a program simply by utilizing the method’s name.

– Procedures: don’t return any value (void).
– Functions: return a value

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

Mod vs Div

A

Mod gives you mathemtical remainder

Div: gives you the number of times A fits into B. So exappe 5 Div 14 = 2, with a mod of 4 (remander )

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

Private, protected, public, extends, static , extends

A

Public: A class, method, field or constructor that is declared public can be accessed from any other class.

Private: Methods, variables, and constructors that are declared private can only be accessed within the declared class itself.

Protected:
Variables, methods, and constructors, which are declared protected in a superclass can be accessed only by the subclasses in any class within the package of the protected members’ class.

extends is the keyword used in a sub class to inherit the properties of a super class

The static keyword in Java means that the variable or function is shared between all instances of that class as it belongs to the class, not the actual objects themselves.
So if you have a variable: private static int i = 0; and you increment it ( i++ ) in one instance, the change will be reflected in all instances

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

Private, protected, public, extends, static , extends

A

Public: A class, method, field or constructor that is declared public can be accessed from any other class.

Private: Methods, variables, and constructors that are declared private can only be accessed within the declared class itself.

Protected:
Variables, methods, and constructors, which are declared protected in a superclass can be accessed only by the subclasses in any class within the package of the protected members’ class.

extends is the keyword used in a sub class to inherit the properties of a super class

The static keyword in Java means that the variable or function is shared between all instances of that class as it belongs to the class, not the actual objects themselves.
So if you have a variable: private static int i = 0; and you increment it ( i++ ) in one instance, the change will be reflected in all instances

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