Java Basics (i)

Source: Internet
Author: User

One: JRE and JDK
JRE (Java Runtime Environment Java Run environment): jvm+ class Library
JDK (Java Developmen Kit Java Development Kit): JRE + Java Development tools

Another: Although Java is a cross-platform, the JVM is not a cross-platform

II: Configuration of the PATH environment variable

1. Create a new variable name; java_home

2. Add variable values for Java_home: JDK installation directory

3. Modify the JDK directory in the PATH environment variable%java_home%\bin;

Three: The difference between path and classpath

1.path environment variables are documented executable files, such as the. exe file, to the executable file in the current path to find, if not found to go to the path of the paths configured in the environment variable to find the 2.classpath environment variables are recorded in the Java class running file is located in the directory Four: Keyword 1. Features: The letters that make up the key are all lowercase 2. Caveats: Goto and const exist as reserved words
Define keywords for data types
Class Interface Byte Short Int
Long Float Double Char Boolean
void

Keywords that define data type values
True False Null

Define the keywords for process Control
If Else Switch Case Default
While Do For Break Continue
Return

Keyword that defines the access permission modifier
Private Protected Public

Defines a keyword for a class, function, variable modifier
Abstract Final Static Synchronized

Keywords that define relationships between classes and classes
Extends Implements

Define an instance and reference instance to determine the keyword of the instance
New This Super instanceof

Keywords for exception handling
Try Catch Finally Throw Throws
The Package keyword
Package Import

Other modifier keywords
Native Strictfp Transient Volatile Assert

Five: Identifiers

Composition rule:

    • English uppercase and lowercase letters
    • numeric characters
    • $ and _

Precautions:

    • Cannot start with a number
    • Cannot be a keyword in Java
    • Case sensitive

Common Naming conventions:

    1. Package-------------All lowercase
    2. Class or interface-----capitalize the first letter of each word
    3. method or variable----start with the second word, capitalize the first letter of each word
    4. Constant------------uppercase, separated by _

Six: Binary

    1. Binary: Consists of 0, 1. Start with 0b
    2. Octal: by 0,1,... 7 composition. Start with 0.
    3. Decimal: Made up of 0,1....9.
    4. Hexadecimal: Made up of 0,1...A...F. Start with 0x

Conversion techniques between the binaries:

    • Binary to octal: three-bit combination, left not enough to fill 0, will be asked for 10 binary data combination
    • Binary to 16 binary: four-bit combination, left not enough to fill 0.

Seven: About shift

Since the computer operates the complement, the moving binary can also be seen as the original code shift for positive shift

EG:3<<2 (3 left shift 2 bit, 3*2^2=3*4=12)

If a negative number shifts, you need to calculate the complement.

Eight: Method overloading:

In the same class, the method name is the same, and the parameter list is different. Regardless of return value

Java Basics (i)

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.