Look at the video to learn Java, do not want to download notepad++ and so on, although know that the Mac has embedded Java SDK, but still do not know how to write, today finally wrote my first Java program, or to the Hello world start
1, open the terminal, java-version see if there is a Java SDK
2, create a Java folder on the desktop (not required), in the folder to create the Hello World folder (easy to manage, not create can also, is a bit messy)
3, go to Hello World folder directory, terminal create Java file: Touch Helloworld.java
4, open Helloworld.java file and you can start writing a
public class HelloWorld {public static void Main (String args[]) { System.out.println ("Hello World"); } }
5, start compiling, terminal input: Javac Helloworld.java
6, start running, terminal input: Java HelloWorld
7, the terminal can see the output: HelloWorld
Writing Java code on Java mac