1/53
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Object
a variable of a data type that is user defined
State
data/attributes about that object
behavior
actions that can be performed on the object
class
template for creating an object
object oriented programming
using object type variables in programming
instance variable
Used to store the state, or data of the object instances.
Constructor
signature of a class that allows for the creation of a new object
constructor name
used to create a new object; must match the name of the class and be in lowerCamelCase
instantiate
Create an instance of a class object
parameter list
variables containing values passed to the constructor
new operator
instantiates a new class object
overloading
The process of using the same operator symbol or identifier to refer to many different functions.
formal parameter
parameters that are outlined in the parameter list in the constructor
actual parameter
parameters that are input when a new instance of a class object is created
client
when we use a class that someone else has created, we become a
methods
procedures that allow us to control and define the behavior of an object
null
a keyword that indicates a reference object doesn’t point to any object data
void
indicates that the method doesn't return anything
procedural abstraction
being able to use code that we don't fully understand
return type
determines the type that will be return from a method
access specifier
determines who has access to using the method when writing classes and objects
objectName.method()
Calling a method
return keyword
used to return a value back to the main program from a method
scope
defines which part of the program a variable can be accessed from
Immutable
Unable to be changed or manipulated. Strings are immutable.
Concatenation
The process of adding two String values together. This creates a new String object. Primitives can be concatenated with String objects
Implicit Conversion
The automatic process of transforming a variables data type. This occurs when a primitive and String object are concatenated by changing the primitive value to a String object type.
Escape sequences
Enable users to use special characters and actions within String objects
name.concat(“value”)
returns a new String with “value” appended to the end of name
name.replace(“a”, ”p”)
returns a new String with all instances of “a” in name replaced with “p”
name.toUpperCase()
returns name as Upper Case Letters
\”
Allows for quotations
\\
includes a backlash
\n
creates a line break
\t
adds a tab space
String(String str) constructor
constructs a new String object that represents the same sequence of characters as str
name.length()
returns the number of characters in a String object
name.substring(2, 6)
returns the substring beginning index 2 and ending at index 5
IndexOutOfBoundsException
A String object has index values from 0 to length - 1. Attempting to access indices outside this range will result in this error
name.indexOf(“d”)
Returns the index of the first occurence of d; returns -1 if not found
name.equals(“Karel”)
Returns true if name is equal to Karel; returns false otherwise
name.compareTo(”Karel”)
Returns a value < 0 if name is less than Karel; returns zero if name is equal to Karel; returns a value > 0 if name is greater than Karel
Application Programming Interfaces
APIs and libraries simplify complex programming tasks by providing sets of clearly defined methods of communication among various computing components.
Documentation
reference for how to use different methods and classes
Wrapper classes
class which contains or “wraps” primitive data types as an object
Integer.intValue()
converts Integer value into an int value
Double.doubleValue()
converts Double value into an int value
Autoboxing
converting a primitive value into an object of the corresponding wrapper class
unboxing
converting an object of a wrapper type to its corresponding primitive value
static methods
methods in Java that can be called without creating an object of a class
Math.abs(x)
returns the absolute value of x
Math.pow(base, exponent)
returns the value of base raised to the power of exponent
Math.sqrt(x)
returns the positive square root of x
Math.random()
returns a double value greater than or equal to 0.0 and less than 1.0