I genius the official Free Tutorial II: Java Introduction and development environment configuration

Source: Internet
Author: User

First, Introduction to Java

As for the history of Java, many online, interested students to understand it, the initial stage only to do a brief introduction, the latter useful to the place in the detailed explanation, if there is doubt, you can contact us, personal data have contact information.

Compilation aspects

The Java language uses both compilation and interpretation

Source file: Source code (generated by developer); stored in source file (Xxx.java file)

Compiler: Bytecode file (compilation generated); stored in bytecode file (Xxx.class file)

Interpreter: Interpreting execution bytecode file

The advantage of this is that the error is checked during the compile phase, the code is optimized, and there is no need to check for errors when interpreting the execution, and the speed is improved. And the implementation of the use of interpretation of the implementation, but also to boast platform.

Three versions of Java SE (Java Standard Edition:java Basic Edition):

Contains classes that form the core of the Java language.

Primarily for programming of desktop Applications (client) software

Java ME (Java Micro Edition:java mini version):

Classes that contain part of the class and radio communication in Java SE

for mobile applications (e.g. mobile games, etc.) and embedded (e.g., monitoring software in electronic products, etc.) development

Java EE (Java Enterprise Edition:java Corporate Edition):

Java EE contains all the classes in Java SE and the classes used to develop enterprise-class applications;

For web development

Some abbreviations: JVM (Java virtual Machine:java vm)

It is a fictitious computer, which is realized by simulating various computer functions on the actual computer, and only Java code can be run on this machine.

API (applicationprogramming Interface, application programming Interface)

The Java language inventors have provided us with some common features.

For example, each software may use the ability to display text on the screen, and the inventor of the Java language provides such functionality for all developers who use the Java language and provides a way to use these features. When the source code for these functions is compiled, the API is formed.

JRE (Java runtime Environment:java Runtime Environment)

The JRE is the integration environment necessary to run a Java program, which includes the JVM and API, etc.

JDK (Java Development Kit:java Developer Toolkit)

A collection of resources and tools to be used when developing Java programs (e.g., JRE, compiler, interpreter, SRC (source code of the API, etc.)


Second, configure the Java development environment


See outreach article: http://blog.csdn.net/ixueba/article/details/47377509



First, write a Java program

The function of this program is to output ABC and XYZ to the screen.

1. Create a source file

Right-click in the blank of the C drive, select New-text document in the pop-up menu, rename the file to Helloword after creating a new text document, and change the suffix name (extension) txt to Java

New text file does not have an extension workaround see: http://blog.csdn.net/ixueba/article/details/47377599

2. Write source code

Open Helloword.java Write the following: Note that all punctuation marks must be in English format

Rote the following code (including the spelling, position, capitalization, and punctuation of each word); public class helloword{//tells the computer here is the entrance to the program, the program will enter from here, step by step down run//The entry format is fixed, The following public static void main (string[] args) {//The code here is executed in the order from the top down to tell the computer to output ABC three letter SYSTEM.OUT.PRINTLN ("abc") to the screen;// A semicolon in English format that represents the end of a statement//This sentence tells the computer to output XYZ three letter System.out.println ("XYZ") to the screen;}} Output Result: abcxyz


3. Compiling source code

Bring up the command Line Prompt window (cmd window); Enter the Javac command to compile the source code, followed by the file name (including directory) of the source file to be compiled, separated by a space between command and file

Syntax format for compiled commands: the directory \ filename where the Javac file is located. java

As in this example: Javac C:\HelloWord.java

After entering the command, press ENTER to execute the compile command, compile the bytecode file (class file), and under the C drive, you can see the generated Helloword.class file

The file name followed by the command can be used in two ways when compiling the files

Absolute path: The path starting from the drive letter (including the drive letter)

Example: Javac C:\HelloWord.java

Compiles the Helloword.java file under the C drive, regardless of the current path

Relative path: path with no drive letter

Example: Javac \helloword.java or Javac Helloword.java

Both commands are compiled with the current path (the current path: If the command Prompt window shows that c:\users\x>_ represents the current path is C:\Users\x), the Helloword.java file

If using: \abc\helloword.java or Abc\helloword.java, represents the Helloword.java file under the ABC folder under the current path

You can also use the wildcard character * to match all. java files in a directory at compile time.

Example: Javac *.java

The function is to compile all the. java files in the current directory

4. Running Code

Format: Java file name (Note: runtime does not need to follow. Java)

Example: Java Helloword (running Helloword)

If CLASSPATH is configured in the system environment variable, the Java program is executed to find the Helloword.class file in the directory of the configured Classpath value, and if no classpath is configured, the default is to find it in the current directory

5, DOS a number of commands

Toggle Drive Letter: Drive letter:

Go back to the top level directory: CD.

Back to root directory: cd\

Go to another directory under the current directory: CD directory or CD \ Directory

Go to another directory under the same disk that is not in the current directory: CD current drive letter: \ Directory,

The Java language writes the software to the running process: writing the source file (. java)-(compiler compilation generation) bytecode file (. Class)-Class loader (ClassLoader) loads the contents of the bytecode file into memory-the JVM reads the contents of the class file in memory. By an explanation of the way an execution-the interpreted binary is handed to the system-the system controls the hardware based on the binary instructions issued by the software

Beginners must pay attention to the following issues, the Java language Coding, strictly distinguish the letter case, all the symbols are in English format; When you write pairs of parentheses, you must first enter both sides of the brackets, and then write the code in the middle of the parentheses, so as to avoid the loss of the half-brackets In addition, note the format of the code, when you encounter the opening brace, you want to wrap the indentation, in the contents of the curly brace, the closing brace is a separate line, and the opening brace is aligned at the beginning of the line.

This article is from the "I Genius Official blog" blog, please be sure to keep this source http://ixueba.blog.51cto.com/10596927/1683123

I genius the official Free Tutorial II: Java Introduction and development environment configuration

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.