Java Basic Knowledge Collation

Source: Internet
Author: User

the difference between 1.JVM, JRE, and JDK.

 (1) JVM (Java Virtual machine): Java VMS, used to ensure the Java cross-platform features, the Java language is cross-platform, the JVM is not cross-platform.

(2) JRE (Java runtimeenvironment): Java's operating environment, including Jvm+java's core class library.

(3) JDK (Java Development Kit): Java development tools, including jre+ development tools.

2. Environment variables the role of path and classpath.

(1) Path: is the search path that configures the Windows executable file, which is the directory where the program file with the. exe extension is located, specifying the path to the DOS window command.

(2) Classpath: Is the directory where the class file is configured to specify the CLASSPATH, which is used by the JVM to find the class class file for it.

3. What is the use of variables? Why do you define variables?

Variables are the amount of data that can be stored, defining variables that are constantly stored as constants of the same type, and can be reused.

The difference between 4.& and &&.

(1) && A short circuit, if the result of the entire expression can be judged by the first expression, do not continue the operation of the subsequent expression, only the Boolean type of data.

(2) & does not have a short circuit, and the entire expression is calculated. You can manipulate either Boolean data or use it as an arithmetic symbol.

5. Naming rules for identifiers

(1) consists of a number (0-9), a letter of uppercase and lowercase, and a composition of _ and $.

(2) cannot start with a number.

(3) You cannot use keywords to customize naming.

6. Data type classification

(1) Basic data types

Integer type: Byte, short, int, long

Floating-point data type: float, double

Character type: Char

Boolean type: Boolean (True and False)

(2) Reference data type

Class, interface, array

7. Type Conversion

Precision from high to Low: double float long int short (char) byte

(1) Auto-convert: Convert from low precision type to high precision type.

(2) Cast: Converts from a high-precision type to a low-precision type (where precision loss may occur).

8. Functions

Definition: A function is a separate applet defined in a class that has a specific function.

Features: (1) The function code can be encapsulated by defining functions.

(2) It is easy to reuse the function.

(3) The function is executed only if it is called.

(4) The appearance of functions can improve the reusability of code.

(5) For cases where the function does not have a specific return value, the return value type is represented by the keyword void, then the return statement in the function can be omitted if the last line is not written.

9. Overloading

Concept: In the same class, more than one function with the same name is allowed, as long as the number of arguments or the type of parameter is different.

Features: Regardless of the return value type, see if the parameter list is the same.

Advantages: Easy to read and optimize program design.

10. Arrays

Concept: A collection of the same data types.

Advantage: You can automatically number the elements in the array starting with 0 to facilitate manipulation of these elements.

11. Memory Structure

Stack memory: Used to store local variables, and when the data is used up, the occupied space is automatically freed.

Heap memory: An array and an object that are stored in heap memory by the instance created by new.

Method extents: Static members, constructors, Chang, thread pools.

Local method Area: consumed by Windows system.

Register: A very important storage unit in an integrated circuit, usually consisting of a trigger.

Java Basic Knowledge Collation

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.