Java basic notes 3, java basic notes

Source: Internet
Author: User
Tags binary to decimal decimal to binary

Java basic notes 3, java basic notes
Keywords of the basic composition of Java language

Words with special meanings granted by java

All letters in the keyword are in lowercase.

Keywords used to define data types: class, interface, byte, short, int, long, float, double, char, boolean, void.

Keywords used to define data type values: true, false, and null.

Keywords used to define Process Control: if, else, switch, case, default, while, do, for, break, continue, return.

Keywords used to define access permission modifiers: private, protected, and public.

Keywords used to define classes, functions, and variable modifiers: abstract, final, static, and synchronized.

Keywords used to define the relationship between classes: extends and implements.

Defines instance creation and reference, and determines the keywords of the instance: new, this, super, instanceof.

Keyword used for exception handling: try, catch, finally, throw, and throws.

Keyword used for the package: package and import.

Other modifiers include native, strictfp, transient, volatile, and assert.

Identifier

Some custom names in the program. It consists of 26 uppercase/lowercase letters, numbers 0-9, and symbols _ $.

Rule for defining valid identifiers: A number cannot start with or use a keyword.

Java is case-sensitive. when naming, it should be meaningful to improve readability.

Naming rules in Java:

Package name: when multiple words are made up, all letters are in lower case. Xxxyyyzzz

Class Name Interface Name: when multiple words are made up, the first letter of all words is capitalized. XxxYyyZzz

Variable name and function name: when multiple words are made up, the first character is the first character. The second character starts to uppercase. XxxYyyZzz

Constant name: All letters are in upper case. When multiple words exist, each word is connected by an underscore. XXX_YYY_ZZZ

Note

Single line, multi-line, document comment

Constants and variable constants indicate unchangeable values.

Classification of constants in Java:

Integer constant: All integers

Decimal constant: All decimal places

Boolean constants: only true and false

Character constant: identifies a number, letter, or symbol with single quotation marks.

String constant: identifies one or more characters with double quotation marks.

Null constant: Only one value is null.

For integers: java has three forms: decimal, octal, and hexadecimal.

Basic hexadecimal conversion

Decimal Binary Conversion:

Convert decimal to binary, divide by 2 to get the remainder

Convert binary to decimal, multiply by the power of 2

Decimal octal Conversion

Hexadecimal conversion

Negative binary representation:

Corresponding positive number binary decimal 1

Variable Concept

 

 

 

Operator

Statement

Function

Array

 

Related Article

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.