Writing Methods
Color Class
Writing Classes
Arrays
Strings
100

The return type for a method that doesn’t return anything.

Answer: What is void?

100

The order of the 3 color values

What are Red, Green, and Blue?

100

What the keyword public does

Why does public make the class, method, or variable accessible by all other classes?

100

The call used to get the size of the array

What is arrayName.length;?

100

What the following code prints

String str = “rylee”; 

System.out.println(str.substring(2)); 

What is "lee"?

200

A method header for a method that takes in the name of an object and age (in full years) and returns the age multiplied by the length of the name.

What is public int anyName(String name, int age)?

200

The range of the values in color

What is the range 0 to 255?

200

Why you would add static to a method or a variable

When do you want a variable to contain a value shared by all instances of the class?

How is a method that belongs to the class different than any specific instances of the class?

200

The message thrown when you try to access an unreachable index in an array

What is an ArrayIndexOutOfBoundsException?

200

What the following code prints

String str = “tungtungtungsahur”; 

str.toUpperCase(); 

System.out.println(str); 

What is "tungtungtungsahur"?

300

The other name for getter and setter methods.

What are accessors and modifiers?

300

The color combination for yellow

What is (255, 255, 0)?

300

A dog class needs to track what its name is. This code initializes that variable

What does private String name; do?

300

A line of code used to access the last index of an array when you do not know what the size is

What is arrayName[arrayName.length-1];?

300

What happens when you try to access an element at a String index that does not exist

What is a StringIndexOutOfBoundsException?

400

The reason the following code fails to compile:

public int makeIdTag(String name, int age, int number)

{//implementation not shown}

public int makeIdTag(String name, int expirationDate, int formerId)

{//implementation not shown}

What is when methods have the same name and the same parameter types in the same order (aka same method signature)?

400

The way to build a new color object

What is Color varName = new color (R, G, B);?

400

Explain private and public methods and when you would use each

Why is it that Private methods can be accessed only by that class, and public methods can be accessed by any class, keyword private are used when you only want methods to perform tasks specific to that class and keyword public are used when you want the classes function to be accessible from outside the class?

400

The result of running this code

String[] arr = { “Five”, “pie”, “ten”, “hi”, “elf”, “seven”};

for (int x = 0; x < arr.length; x+=2)

{System.out.print(arr[x]+” “);}

What is "Five ten elf";

400

What the compareTo() method does

Why does it return an int where if the strings are equal it's 0? If the instance is “smaller” than the passed parameter then it returns a negative number. If the instance is “larger” than the passed parameter then it returns a positive int.

500

When a method header has the same name as another method but takes in different parameters.

What is an overloaded method?

500

The 5 color methods

What are the methods getRed();, getBlue();, getGreen();, brighter();, and darker();?

500

Why field variables are private

Why do programmers make it so that a variable won’t be affected by other things outside of the class?

500

The result of the following code

int[] arr = {5, 2, 7, 1};

for(int x = 1; x < arr.length; x++)

{arr[x] += arr[x-1];}

System.out.print(arr[3]);

What is "15"?

500

What the following code returns 

String str = “dogdograwrruffruffmeowcatdograwr”; 

int index = str.indexOf(“rawr”); 

return index;

 What is 6?

M
e
n
u