In this tutorial I show how to use different types of variables in Java as well as how to use a basic if statement.
Code:
package tutorials;
/**
*
* @author Edward
*/
public class Variables {
public static void main(String args[]) {
String myFirstVariable = "hi"; // Declaration and instantiation
// Camel-case naming convention
char myChar = 'd';
int i = 3;
double myDouble = 1.1;
float myFloat = 1;
if ((i * 2) != 2) { // True
System.out.println("True!");
} else { // False
System.out.println("False!");
}
}
}