YouTip LogoYouTip

Java Tutorial

# Java Tutorial !(#) Java is a high-level programming language launched by Sun Microsystems in May 1995. Java can run on multiple platforms, such as Windows, Mac OS, and various UNIX-based systems. This tutorial will help you better understand the Java programming language through simple examples. Most of the code for the mobile operating system Android is written in the Java programming language. [**Java Online Tools**](#) [**JDK 11 Online Chinese Manual**](#) * * * ## My First JAVA Program Below, we demonstrate Java programming through a simple example. Create a file named **HelloWorld.java (the filename must match the class name)**, with the following code: ## Example public class HelloWorld { public static void main(String[] args){ System.out.println("Hello World"); } } [Run Example Β»](#) > **Note:** Both `String args[]` and `String[] args` are valid, but `String[] args` is recommended to avoid ambiguity and misreading. Running the above example, the output is as follows: $ javac HelloWorld.java $ java HelloWorldHello World ### Command Execution Explanation: We used two commands above: **javac** and **java**. **javac** is followed by the java filename, for example, HelloWorld.java. This command is used to compile the java source file into a class bytecode file, like: **javac HelloWorld.java**. After running the javac command, if the compilation is successful without errors, a HelloWorld.class file will be generated. **java** is followed by the class name in the java file, for example, HelloWorld is the class name, like: java HelloWorld. **Note**: Do not add .class after the java command. Gif demonstration: !(#)
← Java IntroPlugins Layout Tabs β†’