The first day of Java learning !, Day 1 java
18:06:57
Today, I want to officially write a technical blog, not just for the exam, but also for the little dream of being a programmer! Make a little progress every day! Come on!
Now, I will summarize what I learned today:
1.Keywords
Access Control: Private (private) protected public (public)
Class,Method and variable Modifier: Abstract class extends final implements interface native newstatic strictfp synchronized transient volatile
Program Control: Break continue return do while if else for instanceofswitch case default
Error Handling: Try cathc throw throws
Package-related: Import package basic type: boolean byte char double float int long short null truefalse
Variable reference: Super this void
Reserved Words: Goto const
2.Identifier
2.1Definition
1: When Java names variables, methods, classes, and other elements, the character sequence used is called an identifier.
2: The identifiers can be used wherever their names are available.
2.2Valid identifier Definition
1: it consists of 26 English letters (uppercase and lowercase), numbers 0-9, and symbols: _ or $.
2: The digit cannot start.
4: Java is case-sensitive and has unlimited length.
5: The identifier does not contain spaces.
Java 2.3Naming rules
1: package name: when multiple words are made up, all the letters are in lower case. Example: xxxyyyzzz
2: constant name: All letters are in upper case. Multiple words are connected by underscores. XXX_YYY_ZZZ
3: Class Name Interface Name: multiple words are composed of uppercase letters. Description: XxxYyyZzz4: variable name and function name: when multiple words are combined, the first letter is lowercase, And the last letter is capitalized. XxxYyyZzz
3.Note
1. single-line comment: "//…"
2. block comment: "/*… */"
3. Document comment: "/**…… */"
4. javadoc annotation label syntax
@ Author the description of the class indicates the author who developed the class module.
@ Version the description of the class indicates the version of the class module.
@ See references to classes, attributes, and methods, that is, related topics
@ Param: Description of a parameter in the other method
@ Return description of the method description of the return value of the Method
@ Exception description of methods description of possible exceptions thrown by methods
4.Constant
• Constants indicate unchangeable values
• Classification of constants in Java:
1. integer constant. All integers
2. Decimal constant. All decimal places
3. boolean constants. It is special and has only two values. True false
4. character constants. Use single quotes ('') to mark a number, letter, or symbol
5. string constants. Mark one or more characters with double quotation marks
6. null constant. Only one value is: null
• For integers: Java has four forms
1. Binary
2. Decimal
3. octal sequence: 0-7, full 8 into 1, starting with 0.
4. hexadecimal: 0-9, A-F, full 16 into 1, starting with 0x.
5.Negative binary representation
Small rule: the maximum bit of a negative number is 1, and the original number is reversed and followed by 1.