Input/Output
Object Oriented Principles
Class Implementation
Arrays/ArrayLists
Code Segments
100
This method on System.out displays a line of text terminated with a newline character
What is println?
100
Representing a complex algorithm with a simpler name that hides the implementation details
What is abstraction?
100
Instantiate an Student object which has a constructor that takes in a String name and an int for ID.

Student myStudent = new Student("Baxter", 1);

100

What is the correct way to implement an array "x" that will hold 17 integer values?

int x = new int[17]

100
This modifier denotes that a class member is not attached to any one object of that class
What is static?
200
This object, part of the java.util package, is commonly used for input.
What is a Scanner?
200
These are analogous to actions, which the user interacts with an object
What are methods?
200

Write a no argument constructor for the Burger class that sets the values of its two instance variables, integer cals and double price to default values.

public Burger(){


price = 10.50;

cals = 0;

}

200

Write an enhanced for loop to traverse through an ArrayList of Strings named myStrings and print out each element.

for(String x : myStrings){

System.out.println(x);

}

200
This principle guarantees that, when passed as parameters, primitives are immutable yet an object's methods work as expected
What is pass by value?
300
This kind of string, immutable and defined in code, is delimited by double-quotes (e.g. "Hello")
What is a string literal?
300

Write two overloaded methods that could be added to the same class as the following method:

public void mystery(int x){}

public void mystery(String x)

public void mystery(double y)

public void mystery(int x, int y)

300

Write the class header for the clubOfficer class that is a subclass of the clubMember class.

public class clubOfficer extends clubMember{}
300
Given the ArrayList, genshinCharacters, write a method to search through the list and find all the characters' names that begin with a T and store them in the filteredNames list.

for(int i = 0; i < genshinCharacters.length; i++){

if(genshinCharacter[i].substring(0,1).equals("T")){

filterNames.add(genshinCharacter[i])

}}

300
This set of classes are thrown as error messages
What are Exceptions?
400
A term referring explicitly to the joining of two strings with the + operator
What is concatenation?
400
This describes the concept of combining data and methods into one object, such that the data can only be accessed through the methods.
What is encapsulation?
400

Write the class header and constructor for the Painter class.  The Painter class had four instance variables.  Paint, Direction, X, and Y Location.

public class Painter{

private int paint;

private int x;

private int y;

private String direction;

public Painter(int p, String dir, int x, int y){


}


}

400

Given the String array, fantasyNames, write a method to search through the array to find the names beginning with an "A" or ending with "a".  Print out the names.

for(int i = 0; i < fantasyNames.length; i++){

if(fantasyNames[i].substring(0,1).equals("A") || fantasyNames[i].substring(fantasyNames[i].length).equals("a"){

System.out.print(fantasyNames[i]);

}

}

400
These guarantee that a class implements a set of methods providing some set functionality
What are interfaces?
500

What will be returned by the call mystery(3, 2, 6)?

public int mystery(int n, int a, int d){

if( n == 1){

return a;

} else{

return d + mystery(n-1, a, d);

}


}

14

500
When a class extends another class, its parent-class or super-class
What is abstraction?
500
Standard to all classes, this method provides an easy way of converting an object into a printable format
What is toString()?
500

Create a method that removes all the odd numbers from an ArrayList of integers.  The ArrayList name is myNumbers.

for(int i = 0; i < myNumbers.size(); i++){

if(myNumbers.get(i) % 2 != 0){

myNumbers.remove(i);

i--;

}

500
This term refers to the data members of a particular object, unique to its instantiation
What is instance data?
M
e
n
u