Name the 8 primitive data types
byte, short, int, long, double, float, boolean, String
Name two types of conditional statements
if-else if-else and switch
What is the scanner class used for?
Reading information from the user
Name two types of loops
While loop, for loop
Definition of platform independence
Works on all platforms
What is a variable?
Used to store values in Java
What are the conditional operators?
==, >=, <=, <, >, ==, !=, ||, &&, !
What is an import
used to import code that others have written, reuse code
Is for loop a definite loop?
yes
full form of JVM, JDK
Java Virtual Machine, Java Development Kit
Name two rules for naming variables in Java
Case sensitive, camel case, can only start with $, _,
What is the symbol for not equal to
!=
What is the import statement for Scanner
import java.util.Scanner;
Is while loop a definite loop?
What does Java have that is unique in turning source code to machine language
JVM to compile byte code
Write a code fragment to assign a value of 4 to an integer named hello.
int hello = 4;
Write a code fragment checking if a variable a is greater than 2, if it is print true, if not print false.
if(a>2){
System.out.println("true");
}
else{
System.out.println("false");
}
Write a for loop looping through 1 through 10 and printing it
for( int i = 1; i<11; i++){
System.out.println(i);
}
What edition is Java on?
8
Is String a primitive type?
NOOO
What does the following code fragment output?
int x = 1;
if(x<3){
return true;}
else if(x<2){
return false;}
else{
return true;}
true
Read in an integer from the user
int a = inp.nextInt();
int i = 1;
while(i==1){
}
Who invented Java
James Gosling