How to write Java programs with Notepad

Source: Internet
Author: User

The first method of new Java

1 First right-click the mouse, create a new text document.

2 Change the text document to a suffix named. java. Note The file name must be the same as the class name.

If your computer does not display the suffix name, you need to set up a certain computer.

3 Open Computer-Organization-Folder Options-View-uncheck the hidden folder options.

This option is recommended to uncheck, there are a lot of malicious programs will invade our computer, uncheck can be very good to see the types of files such as viruses.

4 Right click on the built document, select Edit can be written in Java.

In writing we have a certain format, the Java language format for our future changes in the convenience of the rules, we must follow this format to write.

The second method

1 Create a new Notepad document, and then choose Save.

Note the save time position, do not wait until the save is not found where the file.

2 Enter the suffix ". Java" in the selected saved window and save it. Note The file name must be the same as the class name.

3 also right click on the file, select Edit can be edited in the file.

The first two curly braces between the carriage return, the second pair of braces have an interval, directly press the TAB key.

Test Run Java Program

Open the Run command, or you can enter CMD to invoke the command window directly in the Open menu.

Where your files are saved, enter your file directory into the command Prompt window, for example, mine is the D-Packing directory, so I type "D:".

Compiles a Java file and generates a class file.

At the command prompt, enter "Javac filename. java", my file name is a, so enter Javac A.java and then return to wait for compilation.

Run the file.

Continue typing "Java filename" and enter to run the file we have written.

Related Article

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.