The first program in Java

Source: Internet
Author: User

There are a lot of tutorials on how to download installation environment variables for the configuration online.

The code for the first HelloWorld is attached below

/**     This is my first Java program */Publicclass  helloworld{    public Static void Main (string[] args)    {        System.out.println ("Hello world!") );    }}

Without an integrated development environment, you write the program to Notepad and change the suffix of the file to. Java this is the standard program for Java source programs. After we're done, we'll start compiling. Now ctrl+r into cmd switch to. java Location//CD (the directory where the files are located) and then enter the Javac file name. After the suffix is compiled, a Java-compiled file with a. Class end appears and then the Java file name is compiled to run Completed the

And then one of the problems is that the file name cannot contain special characters such as _

next to the first program to comment

The top is the comment, Java available comments A total of three kinds of a will be explained

The Top public (access modifier) is the one that tells the program that can access that is inaccessible (refer to C + +)

Class is a keyword this is a class name that is followed by a HelloWorld

Main is still behind the entrance to the program () is the parameter

The following SYS----is the only statement in the content method of the main method that calls the System.out class and then wants the console output HelloWorld

byte code interpretation and execution

C + + (compiled language) is compiled with the executable. exe and Java (interpreted language) compiled with a. Class bytecode file

Bytecode is a set of highly optimized instructions in the Java Runtime System (JVM).

JVM: We do not consider our program to run on that platform, because the virtual machine (JVM) of the different platforms understands the same bytecode, it implements the portability of the platform, and the security (through the JVM before execution, which masks a lot of things). So hackers no one uses Java to black things.

The first program in Java

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.