comp sci methods Flashcards

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

What is the type of method that is used to either print to display or perform some action in the background that we don’t need to see the result for.

A

void methods

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

Methods that do not have print statements in them and perform some function and send the results back to the line of code that called it.

A

return methods

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

Which type of method do we use a variable type instead of void that needs to match the value the method is sending back.

A

return methods

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

What type of method needs to end with a return statement using the word ‘return’ followed by what we want to send back.

A

return methods

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

What method do we have to store in a variable or print statement since it sends back information.

A

return methods

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

What do you call the provided value of a method?

A

parameter

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

Errors in the actual Java code itself is called…

A

compile error

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

what format do errors come in?

A

file, line, and type

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

“___ expected”

A

An error meaning that Java believes that there is a missing symbol in your code.

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

“illegal start of expression” or “reached end of file”

A

Usually means that there is a mismatch in curly braces {}

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

“public class ___ should be in file”

A

Occurs when the class and the java filename do not match.

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

“cannot find symbol”

A

1) The spelling of a var or method may not match from when it was created
2)You may be truing to use a var or method that was never declared in the first place
3) The var does not exist in that part of the program(like looking for an i outside of a for loop)
4)you may be missing an import that is needed

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

“incompatible types”

A

Often happens when the code tries to place one type of value into a variable of another type like putting a string into an int.

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

“missing return statement”

A

Occurs when a return method does not have a return statement or when there is a return only inside of a loop or an if-statement because you must include a return outside of these.

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

“unreachable statement”

A

Occurs when a statement is written in a place that prevents it from being executed and is usually after a break or return statement.

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

Runtime error/exceptions

A

Are errors that happen while the program is running. There is nothing wrong with the code itself, but rather in the execution.

17
Q

“IndexOutOfBoundsException”

A

Occurs when the code attempts to access an index that is not within the existing values.

18
Q

“ArithmeticException”

A

Something went wrong while performing math calculations. Usually dividing by 0.

19
Q

“IllegalArgumentException”

A

When the program passes a value to a parameter that is inappropriate or doesn’t make sense like trying to access a char that has a value of -1