Variables Flashcards
What is a boolean data type?
In Java, a boolean data type is a primitive data type (pdt) used to store a value which could either be TRUE or FALSE. UNDERSTAND?!?!?
What is a String?
A String in Java is a Object that holds multiple characters. It is NOT a pdt.
Remember to store values between double quotes in a String.
How do you compare Strings?
You can use the equals() method to compare Strings. Do NOT use the primitive equality comparator “ == “ .
Some primitive data types?
int char boolean byte long short double float null…..
What is static typing?
In Java, the type of a variable is checked at compile time. This is known as static typing.
Advantage: catch errors at compile time rather than execution time.
Note: declare variables with the appropriate data type else program refuses to compile.
Compound assignment operators?
+= ×= ÷= –= /= %= .
Use: modify the value of a variable using one line of code.
What are control structures?
Control structures or statements allow programmers to determine the order in which a program is executed.
They allow for specificity. So one can skip some statements or lines of code while executing others. One can also repeat one or more statement while some condition is true.