1.java annotations
Single-line comment//
Multiline Comment/* */
Javadoc Comment/** */
(1.javadoc annotations can only be played on classes and methods
2.javadoc can extract annotations to generate HTML files
3. Command format javadoc-d Doc Helloworld.java) (not yet complete operation??? )
2. Package
Better positioning classes, placing classes of the same function in a package
Note: The classes in the Java.lang package do not use import directly
Java package naming requirements do not start with Java, it is recommended to use the company's domain name to write the Java class package
3.jar (Dozen jar packs)
Jar packaging jar CVF Jiami.jar Helloworld.class
4. Identifiers
Currency symbol, letter, number, underline
(Cannot use Java keyword, cannot start with a number)
The Java language reserved but not used keyword goto const
Naming habits
Package name: All lowercase COM.ORACLESDP
Class Name/interface: Capitalize the first letter of each word helloworld/hellointerface
Variable/method Name: First letter lowercase each word capitalized studentname/showname
Constants: Capitalize each word, underline connections between multiple words request_code
5. Eight large base type integer type (byte short int long) floating-point type (float double) character type (char) Boolean type (Boolean)
Corresponding package type Byte short Integer Long Float Double Character Boolean
Object data Type (string)
int I=integer.parseint (str); SYSTEM.OUT.PRINTLN (Integer.parseint (str) +1);//String to basic type
Double d = 2.0-1.1; System.out.println (d);//0.8999999999999999
Floating point loss accuracy problem
Double a=2.0; Double b=1.1; System.out.println (Bigdecimal.valueof (a). Subtract (bigdecimal.valueof (b)). Doublevalue ());} 0.9
(There are altogether 4 construction methods of BigDecimal:
BigDecimal (int) Creates an object with the integer value specified by the parameter. BigDecimal (double) creates an object with the double value specified by the parameter. BigDecimal (long) creates an object with a long integer value specified by the parameter. BigDecimal (String) creates an object that has the numeric value specified by the parameter as a string. BigDecimal operation does not support +-*/This type of operation it has its own method of Operation BigDecimal Add (bigdecimalaugend) addition Operation BigDecimal Subtract (BigDecimal subtrahend Subtraction Operation BigDecimal Multiply (BigDecimal multiplicand) multiplication Operation BigDecimal Divide (BigDecimal divisor) division operation)
Java language Basics