Variables in Java:
String myString = “Hello”;
int coolNumber = 555;
double decimalNum = 3.52;
Java’s split() method:
public class Main{
public static void main(String[] args){
String listOfNames = “alice bob chris diana eric fred”;
String[] nameArray = listOfNames.split(” “);
for (int i = 0; i < nameArray.length; i++) {
System.out.println(nameArray[i]);
}
}
}
Constants in Java:
final int WIDTH = 1920;
Type casting in Java:
String notAnInt = “5”;
int isAnInt = 123;
System.out.println(isAnInt + Integer.parseInt(notAnInt));