this type of variable stores a number with a decimal point
what is the third word in a method header? (if the method is static)
return type
what does charAt(index) do?
returns the character at that index of a String
key words for if statements
if, else if, else
what type of variable does 5 / 3.0 return?
a double!
how many parameters can a method have?
as many as you want :)
True or False, Strings are a primitive type
false
What are two different ways to end your line with a new line ?
use System.out.println or the newline character "\n"
What do Scanners do?
read user input
all chars are also ...
ints
what keyword is used to exit a method and send information elsewhere ?
return
What is the difference between a String and a String literal?
String is a variable containing a sequence of letters,
String literal is character sequence with double quotes, as in "Hello"
what will this print?
System.out.printf("%.2f monkeys", 10.23456);
10.23 monkeys
How do we read in a String from the user?
casting is ...
converting one variable type to another
how do we call a method?
methodName(parameters)
what mathematical operator gives us a remainder?
modulo %
What will this print?
System.out.println( 10 + 20 + 30 + 40);
100
True
The difference between instantiating and declaring a variable is...
instantiating sets the value, declaring allocates memory space (leaves variable empty)
what is the return type for a method that doesn't return anything?
void
What would this return?
String str = "Hello";
str.charAt(5);
which line would print?
String str = "Michael";
if(str.charAt(0) == 'm')
System.out.println("One"); //option 1
else
System.out.println("Two"); //option 2
Two
How do we read in a single character from the user?
scnr.next().charAt(0);