-
Notifications
You must be signed in to change notification settings - Fork 0
Java
Kyle Coberly edited this page Aug 23, 2020
·
5 revisions
- Works left to right, but uses precedence for math
-
Systemis part of thejava.langpackage, which is automatically imported -
finalmakes something a constant, and usesTHIS_CONVENTION - You can cast with parentheses -
double someNumber = (int) 2.1 + 3.4 -
if/else,switch,while,for, logic operators are all the same as JS
- Package = Related classes. Token -> Expression -> Statement -> Method -> Class -> Package
sudo apt install openjdk-11-jdk-headless
// HelloWorld.class
public class HelloWorld {
public static void main(String[] args){
System.out.println("Hello, World!");
}
}javac HelloWorld.class
java HelloWorldint-
String- Compare with.equals, not== -
double- Default float boolean-
char- Get from string with.charAt(position), cast with(char)from unicode
- Why are some types uppercase and others lowercase?