Learn about the fundamentals of Java

Source: Internet
Author: User
Tags modifiers

Java

Is the 1995 Sun Company launched a high-level programming language, is the Internet-oriented language, the language of choice for Web applications (Android bottom, Big Data Hadoop framework written in Java, Spark in Scala, Scala written in Java), (compared to other languages) easy to learn , safe and reliable, fully object-oriented, cross-platform (operating system, completely ignore the operating system, after writing any operating system can be used).

The principle of cross-platform

Java VM---Java Virtual machine---JVM, for different operating systems, the development of different Java virtual machines, a Java program is not directly run on the computer, but run on the Java Virtual machine, A Java Virtual machine translates a Java program into a command that the current system can recognize. The Java language is cross-platform, but the Java virtual machine is not cross-platform.

The technical structure of Java

J2SE---Standard Edition

Java EE---Enterprise Edition

J2ME---Mobile (early for someone, now almost no)

Jdk/jre/jvm

JVM---The premise that Java can cross the platform

JRE---Java Runtime environment---Java Run-time environment---jvm+ Core class Library

JDK---Java Development kit---Java SDK---development tools +JRE

Java.sun.com

Www.oracle.com

1994 Oak---Oaks

Java---After change

JDK1.0 (-jdk1.1-1.2 (applet/swing---GUI later eliminated) -1.3-1.4-1.5 (JDK5.0, 10 features)---JDK6---JDK7.0---JDK8 (can also be called 1.8/ 10 properties) to 1.8 there are more than 3,000 classes and interface methods.

(jdk1.7.0_75 back 75 means update 75 times, regardless of which version is installed, the first 50 smaller versions try not to use)

C:\\Program Files (X86)

Note: Do not appear in the installation path space and Chinese!

Compile

The process of translating Java code into a language that a computer can read

Attention:

1. The file name and class name of the class file correspond to

2. A class file will be generated after each type of compilation is completed

3. The class name of the public class must match the file name of the Java file

4. The Java program runs the portal is the main function, there is no main function, the Java program can compile

Environment variables

Refers to the amount of some running parameters specified for the operating system

(1) New variable name "Java_home", Variable Value "C:\Java\jdk1.8.0_05" (that is, the JDK installation path)
(2) Edit, variable name "Path", at the end of the value of the original variable, add ";%java_home%\bin;%java_home%\jre\bin"
(3) New variable name "CLASSPATH", Variable Value ".; %java_home%\lib;%java_home%\lib\dt.jar;%java_home%\lib\tools.jar "

Key words

Refers to words that are given special meaning in Java

There are 53 keywords, 51 of them are in use, and 2 are not currently used---const, goto---reserved words

Keywords to define the data type

Class

Interface

Byte

Short

Int

Long

Float

Double

Char

Boolean

void

Enum

Keywords to define data type values

True

False

Null

Keywords to define Process Control

If

Else

Switch

Case

Default

While

Do

For

Break

Continue

Return

Keywords used to define access rights modifiers

Private

Protected

Public

Keywords for defining classes, functions, variable modifiers

Abstract

Final

Static

Synchronized

Keywords used to define the relationship between classes and classes

Extends

Implements

Used to define the keywords that create instances and judge instances

New

This

Super

instanceof

Keywords for exception handling

Try

Catch

Finally

Throw

Throws

Keywords for the package

Package

Import

Other modifier keywords

Native

Strictfp

Transient

Volatile

Assert

Note: All keywords are lowercase!

Identifier

Names that are customized in the program

Definition rule: 5 points

1 can be composed of letters, numbers, _, $---do not recommend the use of the $ symbol

2 cannot use pure numbers, numbers cannot start with

3 Cannot use keywords

4Java is a strictly case-sensitive language

5 in order to improve the reading of the program, as far as possible to see the name of understanding

Chinese naming is supported, but not recommended

Class a{}

Class a{} can write like this, but Windows does not allow Windows to be case-insensitive

Hump Naming method

Class Name/Interface name

If it consists of multiple words, the first letter of each word is capitalized HelloWorld

Variable name/method name

If it consists of multiple words, the first letter is lowercase, and the remaining words are capitalized playGame

Package Name

If it consists of multiple words, all letters are lowercase and used in the middle. Separated

Constant name

If it is made up of multiple words, all letters are capitalized, separated by _

Comments

To interpret or explain a program's text in a program.

Format

Comment Text line comment

/* Comment Text */multi-line Comment

/** Comment Text */Document comment---often used for annotation classes, methods, or constants

javadoc-d. \\document Demo.java---This command can only be used to extract the contents of a document comment in a public class

Learn about the fundamentals 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.