Home >Java >Javagetting Started >What issues need to be paid attention to when writing java programs

What issues need to be paid attention to when writing java programs

王林
王林Original
2020-05-18 17:38:233085browse

What issues need to be paid attention to when writing java programs

When writing Java programs, you should pay attention to the following points:

1. Case sensitivity

Java is case sensitive, which means The identifier Hello is different from hello.

2. Class name

For all classes, the first letter of the class name should be capitalized. If the class name consists of several words, the first letter of each word should be capitalized, for example, MyFirstJavaClass.

(Video tutorial recommendation: java video)

3. Method name

All method names should start with a lowercase letter. If the method name contains several words, the first letter of each subsequent word is capitalized.

4. Source file name

The source file name must be the same as the class name. When saving the file, you should use the class name as the filename (remember Java is case-sensitive) and the filename suffix .java. (If the file name and class name are different, a compilation error will occur).

5. Main method entrance

All Java programs start execution from the public static void main(String []args) method.

Recommended tutorial: Getting started with java development

The above is the detailed content of What issues need to be paid attention to when writing java programs. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn