Model 1: Basic Java Programming - Method parameters and return values Flashcards

1
Q

Method parameters and return values #

All value in Java must have

A

a type, and method declarations must indicate the type of parameters and the return value.

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

Method parameters#

Parameters are local variables

A

of the method

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

Method overloading and method signatures#

In Java, you can write two different methods with

A

the same name in the same class, as long as the methods take different parameter types.g

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

Method return values#

In java, the type of value that a method returns must be stated in the method

A

declaration

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

Every method must ______ even if the method has no return value

A

have its return type declared

A function for drawing a smile, for example, might not return anything at all, so it should have a return type of void.

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

The main method returns void#

The method main is declared with public static void. The void indicates that main

A

does not return a value.

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