🧠

Computer Science Programming Language

Java

JVM (Java Virtual Machine)

Programs

  • Every program must have at least one class
    • All other code is inside that class
  • Program always begins executing at the main method
    • main must always be defined in the same way

Data Types

KeywordSizeDescriptionValue
byte1 byteByte-length integer$-128$ to $127$
short2 bytesShort integer$-32768$ to $32767$
int4 bytesInteger$-2147483648$ to $214748364$
long8 bytesLong integer$-2^{63}$ to $2^{63} - 1$
float4 bytesSingle-precision floating point
double8 bytesDouble-precision floating point
char2 bytesA single characterAll characters
booleanN/AA Boolean valueTrue or false