# Java Language

Strict object-oriented programming language.

* Forces an object-oriented model where the main method is in a class.
* Forces a one-class-per-file approach.
  * The name of the file must match the public class in the source code.

Can be used in a wide range of scenarios.

* **Mobile**: Android applications <- **focus of this class**.
* **Desktop**: CLI or Desktop applications.
* **Server**: Web apps using application servers.
* **Web**: Java Applets, and Java Web Start, sometimes via Java Network Launch Protocol.
  * Mostly dead as browsers dropped support due to security concerns.

Promotes the motto: **Write once, run anywhere**.

* **Enabled by using bytecode instead of machine code.**

Bytecode **runs on a Java Virtual Machin**e.

* JVM implementation **interprets bytecode in a pseudo-CPU**.
* **JVM is implemented natively** for each supported architecture.
* Host architectural aspects are not directly exposed to applications.
  * Access is mediated (and limited) by the interfaces exposed by the JVM.

Source files must have .java extension.

* import statement can be used to get features from other classes.

**Compiled bytecode is in .class files.**

* The class filename matches the class inside, which enables dynamic, on-demand loading.
* For nested classes, the name of the .class file also reflects this structure.
