First knowledge of Java

Source: Internet
Author: User

What is Java?
Java is a programming language introduced by Sun.
It is a language that is executed by means of interpretation. Java is divided into three systems
Java SE (j2se,java2 Platform Standards Edition, Standard Edition)
Java EE (J2ee,java 2 Platform, Enterprise Edition, Corporate Edition)
Java ME (J2me,java 2 Platform Micro Edition, miniature version)

Java Basic Syntax:
The following points should be noted when writing Java programs:
Case-sensitive: Java is case-sensitive, which means that the identifier Hello is different from hello.
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, such as Myfirstjavaclass.
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, such as Myfirstjavamethod, is capitalized.
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 to save the filename (remember that Java is case-sensitive), and the suffix of the file name is. java. (a compilation error is caused if the file name and the class name are not the same).
Main method Entry: All Java programs are executed by the public static void Main (String[]args) method.

Java Execution Structure:
1) file name. Java (first letter must be uppercase, hump logo)
2) Structure:
public class class name (consistent with file name, case sensitive) {
public static void Main (string[] args) {
Variable definition, constant definition, looping, branching ....
System.out.println ("Hello World");
}
}
3) Compile (Java compile):
Go to the directory where the source file is located, enter the Javac file name. Java, a binary file (. Class) is generated after compilation
4) Explanation (JVM Run)
Java class name

Some questions to note about Java:

Why not install a public JRE?
The public JRE is a standalone JRE system that is installed separately under the other paths of the system. The common JRE will want to register the Java Runtime environment with IE browser and system. In this way, the common JRE can be used by any application in the system. There is little need to install a common JRE because there are fewer opportunities to execute applets on the Web page, and it is entirely possible to use the JRE under the JDK directory to run the Java re-program.

Once the JDK is installed, you can see the following path:
1) Bin: A variety of tool commands for the JDK under this path, commonly used Javac, Java and other commands are placed under this path.
2) DB: This path is the path where Java Db is installed.
3) Demo: This path contains the demo code provided by the JDK.
4) JRE: The JRE environment required to run the Java program is installed under this path.
5) Lib: This path holds the actual execution program of the JDK Tool command.

First knowledge of 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.