Java entry-level instance helloworld

Source: Internet
Author: User

Today, I officially started learning java. The first example of learning a language is helloworld! Why use this example as an entry-level instance? It seems simple, but it contains a lot. Is it true that the essence of language is in it? Let's take a look. Now I know that to implement it, at least we have to do the following:

1. When installing JDK (jdk-7-windows-i586.exe is installed), you should learn to download the software online and install it on the PC correctly. You 'd better set the installation path, for example, C: \ Java.

2. For ease of operationCode, We need to set the environment variable path, right-click: My computer-> properties-> advanced-> environment variable-> system variable... double-click path (add one if no one exists), and add c: \ Java \ bin to the end. Separate the path from the preceding address with a semicolon. Set the environment variable classpath as described above. After the settings, restart the running window.

3. You must create a Java file with the suffix of Java, properly encode it, and save, compile, and use Java helloworld.

4. Correct encoding: both of the following are correct.

Public class helloworld {public static void main (string AGRs []) {system. Out. println ("helloworld! ") ;}} Public class helloworld {public static void main (string [] AGRs) {system. Out. println (" helloworld! ");}}

5. The helloworld name after the class must be the same as the saved file name, including the case.

6. The encoding is strictly case sensitive. helloworld and helloworld are completely different.

7. Pay attention to the format and correct indentation when writing code.

8. Write the file suffix during compilation, for example, javac helloworld. Java, and javac helloworld compilation will cause errors.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.