.length() and an integer value with the length
We treat primitive data types as objects by using a...
wrapper class
When you do your conditional if statement, is there a semi-colon?
No
Can multiple different data types be stored in an array list?
No, an array list needs to be composed of elements of the same data type.
The parent class is called the...
Super class
String word1 = MoNdaY;
What could you use to make word1 all lowercase?
word1.toLowerCase()
The wrapper classes for int, double, and boolean are...
Integer, Double, and Boolean
What are the Java symbols for "and," "or," and "not" used in conditional statements?
&&, ||, !
How do you declare an ArrayList?
ArrayList<Datatype> name = new ArrayList<Datatype> (# of elements);
What is the keyword that allows us to leverage the constructors and methods in the superclass?
super keyword
If you use the .index("d") method on the word "Friday," what will be returned?
3
Java CAN or CANNOT automatically convert between primitive data types and their wrapper class objects?
CAN!
13 % 8 == _____
5
Describe what the method add(i, e) does in an ArrayList
It adds element e at index i (it inserts it, does not replace it)
Fill in the blank (creating a sub class):
public class Parent ____ Child
extends
String word = "AP Computer Science";
System.out.print(word.substring(0, 7));
What is printed?
AP Comp
Declare a new int using the wrapper class, Integer.
Integer name = new Integer(10)
Write all the Java equivalents to the symbols below:
1. >
2. <
3. ≥
4. ≤
5. =
6. ≠
1. >
2. <
3. >=
4. <=
5. ==
6. !=
In ArrayLists, you cannot store primitive data types (int, double, boolean). So, what do you do if you want to make an ArrayList of ints, doubles, or booleans?
Use their wrapper classes and autobox them.
True or False: a sub class has access to everything in the super class regardless of whether it's public or private
False. Must be public
String a = "sleepy";
String b = "awake";
System.out.print(b.compareTo(a));
What is printed?
-18
Primitive --> object
Autoboxing or unboxing?
Autoboxing
Using De Morgan's Law, simplify this expression:
!(A == B && A <= B)
A != B || A > B
When using selection sort to order ArrayList values from smallest to largest, do you use the < (greater than) or > (less than) symbol?
> Less than
Define overriding.
When a method has the same parameter as it's parent class but it performs a different action.