[Java](https://www.java.com/en/download/) is a programming language on which many desktop applications are run.
## installation
If you only need Java to run another app installed on your system, download Java [here](https://www.java.com/en/download/). If you need to install for your user only, check the box "Change destination folder" on the first screen and create a directory in the same style as the suggested (`Java/jre1.8.0_351`).
> [!example]- Installation Screens
>
> 
>
> 
>
> 
>
> 
>
To develop with Java, you need the latest Java Development Kit from [OTN downloads](https://www.oracle.com/java/technologies/downloads/#jdk24-windows). The process is similar as above.
Developers may also want to also install
- [[IntelliJ]] (IDE; free community edition available)
- [[Gradle]] (for environment management)
- [[JUnit]] (for testing)
## learn Java
Read Google's [Java style guide](https://google.github.io/styleguide/javaguide), learn [[best practices for commenting code]], and write [clean Java code](https://digma.ai/clean-code-java).
Other useful resources include
- [Learn Java course](https://www.codecademy.com/learn/learn-java) | codeacademy
- [Jenkov Tutorials](http://tutorials.jenkov.com/java/your-first-java-app.html) | Jakob Jenkov
- [Think Java](http://greenteapress.com/thinkjava/) | Allen Downey and Chris Mayes
- [The Java Tutorials](https://thinkjava.org/tutorial) | Oracle
- [Java cheat sheet](https://introcs.cs.princeton.edu/java/11cheatsheet/) | Princeton
## basic Java
A Java program at its simplest is a a collection of objects and a `main` program. `main` is used to bootstrap objects. Best practice is to put as little in `main` as possible and let objects do the work instead.
Here is a basic "Hello World" application in Java, which should be stored in a file named `HelloWorld.java`.
```java
public class HelloWorld {
public static void main(String[] args) {
// generate some simple output
System.out.println("Hello, world!");
}
}
```
When this file is compiled, it will create a file called `HelloWorld.class`.
A simple class to define a car and its speed with getter and setter might look like this.
```java
public class Car {
private int speed;
// constructor
public Car(int speed) {
this.speed = speed;
}
// getter
public int getSpeed() {
return speed;
}
// setter
public void setSpeed(int speed){
this.speed = speed;
}
}
```