Writing the first Java program

Source: Internet
Author: User

Installed an editor, notepad++, this editor used to write PHP, like to use, hehe, now write Java also first follow this editor.

Code:

 Public class test{    publicstaticvoid  main (string[] args) {        System.out.print ( "hello!");    // output Java     }}

According to the current understanding:

System.out.print (); This is the output statement.

System.out.println (); This is a newline output statement.

Each class name must be the same as the file name, or it will be an error.

Each file must be written above the main frame, that is, the above code, in addition to the output of the statement unexpectedly, the specific reason to write this, and then understand it later.

Java is strictly case-sensitive, so be sure to pay attention.

Java is developed by Sun, divided into three major systems, Java SE (Do desktop development), Java EE (do Web development), Java ME (do embedded development, such as mobile phones, small appliances, etc.)

After the code is written, save the file as Test.java (the Java suffix is. java), save to the E drive, and then turn on DOS

Input e: Enter, switch to the E-drive

Input Javac Test.java Enter, execute this DOS command, will compile the Java file, because Java is to be compiled into binary to execute, after compiling in the sibling directory will produce a same file name, different suffix, suffix. Class of the compiled file. Now that the Test.java file has been compiled, you can execute the

Enter Java Test carriage return, you can execute Java program, the above code will output hello!

Writing the first Java program

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.