1/77
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
accessor
a method that accesses an object but does not change it, normally returns a value.
access specifier
Indicates who has access to the information/code. Used on method headings and class level variables. If public anyone has access. if private, only usable within the class. Typically, methods are public and instance fields(class level(declared outside of methods) non-static variables) are private.
actual parameter
This is the explicit parameter in the calling statement only. The value must already exist in order for you to pass the value to the method. i.e. it actually exists.
API
documentation for all classes in the JDK. It has the public interface for the methods (basically the method heading and class description) so that someone can execute those methods. It does NOT include the information from the method body on how the task is completed. It includes public class level variables also.
argument
another name for the explicit parameter/actual parameter in a calling statement.
assignment operator
= is the operator used to place a new value into a variable.
class
a programmer-defined data type, typically a blueprint for an object. Contains the class level non-static variables that make up the attributes of the object and the methods/behaviors that the object can do.
constructor
a method that initializes a newly instantiated object, no return type, same name as the class.
double
the double type denotes floating-point numbers that can have fractional parts.
explicit parameter
input to a method - placed in the parenthesis following a method identifier. It can be in a calling statement or an method definition.
floating-point number
a number that can have a fractional part.
formal parameter
the explicit parameter in the method definition only. It must have a data type as you are declaring a variable/getting space to hold the values that are being passed to the method. They are not initialized here as they will get their value with someone invokes this method (i.e. they are initialized to the corresponding actual parameters value).
identifier
the name of a variable, method or class.
implicit parameter
The object on which a method is invoked. For example, in the call x.f(y), the object x is the implicit parameter of the method f. It is only in the calling statement. Can only have one per method that is invoked.
import
Java classes are grouped into packages. Use the import statement to use classes that are defined in other packages.
instantiation
In general it is the process of creating/initializing one instance of an object and requires the use of the new operator with a constructor method.
integer
a number that cannot have a fractional part
method
a sequence of statements that has a name, may have formal/explicit parameters, and may return a value. A method can be invoked any number of times, with different values for its parameters.
mutator
a method that changes the state of an object, usually a void method (returns nothing)
immutable
a class that has NO mutator methods. The String class is immutable.
object
a value of a class type
object reference
a value that denotes the location of an object in memory. In Java, a variable whose type is a class contains a reference (address) to an object of that class.
overloading
giving more than one meaning to a method name. An overloaded method is a method (same name) with multiple implementations in the same class with different parameter lists. ie it has a unique signature. No class can have two methods with the same signature.
package
a collection of related classes. The import statement is used to access one or more classes in a package.
parameter
an item of information that is specified to a method when the method is called. For example, in the call System.out.println("Hello, World!"), the parameters are the implicit parameter out and the explicit parameter "Hello, World!".
primitive type
in Java, a number type, char or boolean. Primitive types are not objects, and cannot invoke methods. They hold the value (instead of an address of the value). Ex. Double and Int
private implementation/private access specifier
the private implementation in a class describes the data inside its objects and the instructions for its methods. Not directly accessible outside of the class.
public interface
the public interface of a class specified what you can do with its objects. Basically, this is the information available in the public method definition/header. The statements inside the method are private.
return value
the value returned by a method through a return statement
return type
this is part of a method heading and shown in the public interface in an API for the class. It indicates the TYPE of data that is to be returned from the method.
type
A named set of values and the operations that can be carried out with them (if any).
variable
a symbol in a program that identifies a storage location that can hold different values.
Data Type
The data type tells the computer how much storage is needed for that variable and what things that data is allowed to do.
Creating a Variable
You must declare it using the following syntax before using it. You will ONLY declare it once.- dataType VariableName; ex: int age;
int
will hold whole numbers and can do whole number math functions - add, subtract, multiply, divide, modulus (remainder) uses 4 bytes of memory.
Objects
are entities in your program that you manipulate by calling methods of that class.
Reference Data Types
Objects belong to a class. The amount of storage for the object varies so the Variable name points to an address, not the actual data.
String
this is a special type of object. String variables will point to an address of where the data is located.
Initialize
You must initialize / assign a value to any variable before you can use it.
Syntax Rules for Identifiers
1) can only use characters, numbers, underscore "_" and dollar sign"$" 2) cannot start with a number 3) cannot use blanks 4) cannot use any other special symbols such as "," "/" or "&" 5) cannot use reserved keywords OR identifiers already declared in the program.
Case Sensitivity
Identifiers are case sensitive - NAME, Name, and name are three different identifiers.
Convention for Class Identifiers
Class identifiers start with upper case letters.
Convention for Variable and Method Identifiers
Variable and Method identifiers start with lower case names.
Meaningful Identifiers
Identifiers should be meaningful - use "gpa" not "g."
Concatenation
putting two separate fields together, side by side. Does not add the contents of the fields.
reserved
part of Java language. Ex: public, void, static
pre-defined in libraries
ex - method names like println
user defined
created by the programmer
Assignment
"=" assigns the value on the right to the variable on the left.
primitive variable
passes the actual value to be stored.
reference variable
stores the address of the object.
new operator
used from another class to create an object of this class.
an operator that allocates new objects - gets space and address of that space. (The amount of space needed is determined by the non-static class level variables known as instance fields in the object class)
class method
a sequence of instructions that accesses the data of an object.
PrintStream
a class with out as a pre-defined object created in the System class.
String class
a class for an object that contains a set of characters.
length method
returns the number of characters including special symbols and blanks that are contained in the string object passed as the implicit parameter.
toUpperCase method
returns a copy of the implicit parameter converted to have only upper case characters.
toLowerCase method
returns a copy of the implicit parameter converted to have only lower case characters.
replace method
carries out a search-and-replace operation, constructing a new string by replacing all occurrences of the first explicit parameter with the second explicit parameter.
Constructor method
instantiates the object - declare and initialize and return the reference (address) of the new object.
instantiating
the process of constructing the object using the new operator.
method name overloading
occurs if a class has more than one method with the same name (but different parameter types).
method signature
the name of the method along with the data types of the explicit parameter if there are any.
Return values
Information that some methods return after performing calculations or actions.
Void
The reserved word used in the method header/definition to indicate that a method does not return any value.
Test Programs
Programs that verify that one or more methods have been implemented correctly.
Packages / Libraries / Import
Collections of similar programs in Java that need to be imported into your program.
API (Application Programming Interface)
Documentation that lists the classes and methods of the Java library.
Variables
Used to store values that you want to use at a later time.
Identifiers
Names for variables, methods, and classes composed of letters, digits, and underscores, cannot start with a number or be a reserved word.
Initialization
All variables must be initialized before you access them.
Overloaded method
A method name is overloaded if a class has more than one method with the same name but different parameter types.
Double type
Denotes floating-point numbers that can have fractional parts.
Arithmetic operators
Operators such as +, -, and * used to combine numbers.
Multiple object variables
Can contain references to the same object.
Number variables
Store numbers, while object variables store references.