What data type should store a value such as 3.14?
What is a double?
What does the method length() do?
What is returns the number of characters in a string?
What keyword is used to create a new object?
What is new?
int x = 7;
double y = (double) x / 2;
System.out.println(y);
What is 3.5?
What keyword sends a value back from a method?
What is a return?
int x = 7/2;
What is the value of x?
What is 3?
How do you properly compare two strings?
What is .equals?
List the two properties of objects.
What are state and behavior?
String s = "Java";
System.out.println(s.charAt(2));
What is v?
What is the return type of this method?
public static void printHello()
What is void?
What are the possible values of
(int) (Math.random() * 7) + 1
What are 1,2,3,4,5,6,7?
What does "hello".toUpperCase() return?
What is "HELLO"?
Objects created from a class are called
What are instances?
!((true && true || false) || false && true || (!false && true))
What is false?
What must a constructor have in common with the class?
What is Has the same name and no return type?
What is printed?
System.out.println(Math.pow(3, 3));
What is 27?
What does "java".substring(1, 3) return?
What is "av"?
On a Student object sname,
sname.getGrade(); would be called
int a = 3;
int b = 6;
a = a + b;
b = a - b;
a = a - b;
System.out.println(a + b);
What is 9?
What is a constructor’s purpose?
What is To initialize instance variables?
What is printed?
System.out.println((double) 10 % 3);
What is 1.0?
String s = "Code";
System.out.println(s.indexOf(2));
What is invalid usage (-1)?
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?
String s = "hello";
s.replace('h', 'j');
System.out.println(s);
What is hello?
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?