The flashcards below were created by user
dimeng
on FreezingBlue Flashcards.
-
Methods reside ____________ of your main method.
outside
-
In order to exedute the code in a method, you have to ___________________ the method by name and ___________________.
call/invoke, pass it parameter(s)
-
If the method _____________________, you can save it in a variable to use later, print it to the screen, or use it as a value in an expression.
returns a value
-
If the method doesn't return a value, then the return type of the method is ___________.
void
-
Required parts of a method:_________________, __________________, _____________________, ______________________.
return type, name, parentheses, body between {}
-
Optional parts of a method: _____________, ______________________.
modifiers, parameters between parentheses
-
You can have two or more methods with the same name in a class (overloading), if the methods' input parameters differ by ________, _________, and/or _________.
number, type, order
-
You __________ overload based on return type.
cannot
-
Parameter names and variables declared in the method are _____________ to the method.
local
-
Primitive values passed to methods are pass-by-value --- i.e., the original value of the variable is ______________.
not changed
-
Arrays are a collection of variables of _______________ type(s).
the same
-
Arrays _________ contain class types.
can
-
The size of an array is _____________ (the single instance variable of the array - length - is _____________).
fixed, final
-
You can access elements in an array using its __________________ and ______________.
reference (name), an index
-
The first index in an array is _________, while the last is the __________________________.
0, length of the array - 1
-
Arrays passed to methods are pass-by-sharing -- changes __________ be made to the array in the method.
can
-
Arrays _______ be method parameters and be returned by methods.
can
-
Arrays can be searched for a ___________________.
specific element
-
___________________ search traverses the array in order and compares each element to what you are searching for.
Sequential/linear
-
A search is more efficient if the array is _________________.
pre-sorted
-
A two-dimensional array created in the following way int a = new int[4][3] has ___ rows and ___ columns. In this declaration, a is a ________ dimensional array, a[2] is a ______ dimensional array, and a[2][0] is __________. The length of a is _______, while a[1].length = _______.
4,3, 2, 1 , integer, 4,3
-
Traversing a two-dimensional array is easily performed with _____________________.
two nested loops.
-
A ragged (jagged) array is an array with rows of different ________________.
lengths
-
Multi-dimensional arrays ______ be method parameters and be returned by methods.
can
-
Strings can be turned into a char[] with the help of the __________________ method.
.toCharArray()
-
Strings mimic a character array and accessing a character at position i in a string happens with a call to the ____________ method.
.charAt(i)
-
The ___________ method is used when you want to divide a delimited String into a String[].
.split()
-
You can match a character, a sequence of characters of use __________________ to match any character in a selection of characters.
square brackets, e.g. []
-
Images can be read into a two-dimensional array with the help of the ________________________ class.
PixelReader
-
In order to add an image into a JavaFX application window, you have to add the image to a __________, which is put into a __________, which resides in a ___________.
stage
-
Each _____________ should be in a .java file by itself.
class
-
The name of the class is the name of the __________.
file
-
A(n) __________ is a(n) ______________ of a class.
object, instance
-
A class defines the ___________ and behavior of objects.
properties
-
Objects of a class are variables of that ____________.
type
-
Classes have ______________, they only specify the structure of objects of that type.
no data
-
The access modifier __________ means that the thus declared variable/object/method/class can be accessed by name directly from any other class.
public
-
Instance variables should be ____________ to protect them from unauthorized or accidental changes.
private
-
Getter and setter methods are ____________.
public
-
Objects are created with __________.
new
-
When objects are created, the ____________ of the class is called, which sets the values of the ______________________.
constructor, instance variables
-
Each object _______________ set of instance variables and methods as defined by the parent class.
has its own
-
Constructors ________________ a return type and a return statement.
do not have
-
Constructors have _____________ name ______________ the class.
the same, as
-
If you want to change the state of an object you ___________ call the constructor; you must call _______________.
cannot, set methods
-
You ____________ create your own constructors.
can
-
Constructors ______________ call other constructors.
can
-
The Java reserved word ____________ points to the object receiving the method call.
this
-
The main method is ______________.
static
-
____________ variables and methods belong to the ____________ and there _________________ copy(s) of them.
Static, class, is only one
-
Static variables and methods are accessed with the ______________ name.
class
-
A static method can access the instance variables of an object only if the object is _______________________________.
passed to the method
-
The state of an object passed to a method _____________ be changed, but the object __________________ be replaced with another object.
can, cannot
-
Wrapper classes are used to convert ______________ type values to "equivalent" _____________ type values.
primitive, class
|
|