ap comp sci unit 2 test Flashcards
state/attributes
instance variables in java
behavior
methods in Java
Class
Blueprint for objects
Overloading
Having many constructors with same name but different constructor signatures (parameters)
non static methids
objectName.method();
NullPointerException
Creating a non static method on a null object = error
name.concat(“value”)
Returns a new String with “value” appended to the end of name
name.replace(“a”, “p”)
Returns a new STring will all instances of “a” replaced with “p”
Strings are immutable
They cannot be changed but we can reassign it
"
Allows for quotation marks
““\monkey/””
\
Includes a backlash
At the end
Ex: Includes a backlash\
\n
“This creates \na line break
This creates
a line break
\t
“This adds a \ttab space”
“This adds a tab st[ace
name.length
Returns the number of characters in a String object ( returns an int)
name.substring(4)
Returns the substring beginning at index 4 and ending at the last index