2+2=5
String Theory
These are objects
Snippets
Methodology
100

What data type should store a value such as 3.14?

What is a double?

100

What does the method length() do?

What is returns the number of characters in a string?

100

What keyword is used to create a new object?

What is new?

100

int x = 7;

double y = (double) x / 2;

System.out.println(y);

What is 3.5?

100

What keyword sends a value back from a method?

What is a return?

200

int x = 7/2;

What is the value of x?

What is 3?

200

How do you properly compare two strings?

What is .equals?

200

List the two properties of objects.

What are state and behavior?

200

String s = "Java";

System.out.println(s.charAt(2));

What is v?

200

What is the return type of this method?

public static void printHello()

What is void?

300

What are the possible values of 

(int) (Math.random() * 7) + 1

What are 1,2,3,4,5,6,7?

300

What does "hello".toUpperCase() return?

What is "HELLO"?

300

Objects created from a class are called

What are instances?

300

!((true && true || false) || false && true || (!false && true))

What is false?

300

What must a constructor have in common with the class?

What is Has the same name and no return type?

400

What is printed?

System.out.println(Math.pow(3, 3));

What is 27?

400

What does "java".substring(1, 3) return?

What is "av"?

400

On a Student object sname, 

sname.getGrade();  would be called

What is a getter?
400

int a = 3;

int b = 6;

a = a + b;

b = a - b;

a = a - b;

System.out.println(a + b);

What is 9?

400

What is a constructor’s purpose?

What is To initialize instance variables?

500

What is printed?

System.out.println((double) 10 % 3);

What is 1.0?

500

String s = "Code";

System.out.println(s.indexOf(2));

What is invalid usage (-1)?

500

public class Counter {

    private int count;

    public Counter(int start) {

        count = start;

    }

    public int getCount() {

        return count;

    }

}

Counter c = new Counter(5);

System.out.println(c.getCount());

What is 5?

500

String s = "hello";

s.replace('h', 'j');

System.out.println(s);


What is hello?

500

Why does this not compile?

public static void test() {

    System.out.println(a + b);

    return 5;

}

What is a void method can not return a value?

M
e
n
u