813 % 100 / 3 + 2.4
6.4
2 * 3 / 4 * 2 / 4.0 + 4.5 - 1
4.0
89 % 10 / 4 * 2.0 / 5 + (1.5 + 1.0 / 2) * 2
4.8
How many students are in our class?
25
What do all java programs need in order to run?
Class + main method
Declare an array called 'seniors' that is the size of the number of Seniors in our class
int[] seniors = new int[7];
What does OOP stand for?
Object Oriented Programming
Data __________ is a technique in which the implementation details of a class are kept hidden from the user
encapsulation
String patrick = "Patrick";
Write an expression that prints if the number of letters in patrick is even or odd.
if (patrick.length() % 2 == 0 ) {
System.out.println("even");
} else {
System.out.println("odd");
}
Static methods are associated with the class, not _________ of the class
objects
what method returns the number of elements in an arraylist?
int size()
Declare an array called 'sophomores' that is the size of the number of Sophomores in our class
int[] sophomores = new int[5];
Declare an array called 'juniors' that is the size of the number of Juniors in our class
int[] juniors = new int[13];
8 + 6 * -2 + 4 + "0" + (2 + 5)
007
2 + "(Ryan) 2.0" + 2 * 2 + 2
2(Ryan) 2.042
Create an array in a single line of code called 'names' that contains all of the students in our class with first names that begin with the letter 'A'
String[] names = {"Aki", "Allison", "Andy"};
Create an array in a single line of code called 'names' that contains all of the students in our class with last names that begin with the letter 'L'
String[] names = {"Sam", "Charlie", "Sebastian","Simon"};
Comments are ignored by the __________ and are not executed when the program is run
comments
Create an array in a single line of code called 'names' that contains all of the students in our class with first names that have repeating letters in it.
Ex: "Peter" has 2 e's
String[] names = {"Allison", "David", "Sally","Will","Sebastian","Connor","Hanna","Daniela"};
What class do all java classes inherit from?
Object class
Consider the following method.
public static int calcMethod(int num) {
if (num == 0) {
return 10;
}
return num + calcMethod(num / 2);
}
What value is returned by the method call calcMethod(10) ?
28
What is Ms. Pletcher's middle name? hint: ggnlnthii
Lightning
Apply De Morgan's law to this:
!(A && B)
!A || !B
System.out.println("Patrick Bowers".substring(4,10));
ick Bo
What is Patrick's middle name? hint: ohsamt
Thomas