First knowledge of Java -- (Java study note 1), first knowledge of java Study Notes

Source: Internet
Author: User

First knowledge of Java -- (Java study note 1), first knowledge of java Study Notes
Core advantages of JAVA: cross-platform-JVM (JAVA Virtual Machine) Implementation of JVM: a standard identifier of the JAVA Virtual Machine: only the following line, dollar sign ($), consisting of letters and numbers, cannot begin with a number float :( occupies 4 bytes of storage space) floating point does not accurately represent all decimals, there is a rounding error. double occupies 8 bytes of storage space. char occupies 2 bytes. int occupies 4 bytes of Boolean Type (one byte is not one byte ), if a byte occupies 8 digits and requires precise height, both the BigDecimal double and float types cannot accurately represent a numerical value. Automatic Data type conversion: why can a small data type be converted to a large data type? java can run across platforms: java can run across platforms because it does not directly run on any underlying platform, instead, you need to prepare your own java platform in advance. JVM (java Virtual Machine) is the runtime environment of the java language. The java compiler generates class files for the jvm, therefore, the java interpreter independent of the platform is responsible for running jvm code on a specific platform. The java virtual machine is not cross-platform. Class file --- the main method of bytecode file:

The program entry ensures that the program runs independently and is called by jvm.

Data Type: Basic Data Type and Reference Data Type

Basic data types: Numeric (byte, int, long, short), floating point (float, double), char, Boolean) reference data types: Class, enumeration, annotation, interface, array ([]) bytes: byte (8), short (16), int (32 ), long (64), float (32), double (64) Small -----> large byte, short, char <int <long <float <double integer default: int Floating Point default: double type conversion: automatic type conversion is also called implicit type conversion (up conversion) (small ----> large), forced type conversion is also called explicit type conversion (large ------> small) + + after the variable, it indicates that the first operation is to add 1 + + before the variable, indicating that the first operation is to add 1 to 1.0/0 or 1/0. the result of 0 is Infinity (positive Infinity) because the value type is increased to the precision ratio of double type. in T High Precision + =,-=, * =,/=, % =: There is an implicit type conversion difference or (^): The same is FALSE, the difference is TRUE "&" and "&": single and real operations are performed on the right, regardless of whether the left side is TRUE or false. If the left side is TRUE and the right side is involved in the operation, if the left side is false, the right side is not involved in the calculation. "|" | "the same is true: Double or, if the left side is TRUE and the right side is not involved in the operation "^" and "|", when both the left side is TRUE, the result of "^" is FALSE short-circuit and (&&): when the operation on the left side is FALSE, the right side is not judged to be short-circuited or (|): when | the operation on the left side is TRUE, no judgment | the operation on the right. Ternary OPERATOR: Boolean expression? Statement 1: Statement 2 execute Statement 1 when Boolean is TRUE. If Boolean expression is FALSE, execute Statement 2 shift: Left shift (>>) and right shift (<) shift left (shift right): shifts the binary code to the left to specify the number of digits. If the value is left, use the 'sign bit' to add 1. If the value is positive, use 0 to add 2. If the value is negative, 1 is used to add the unsigned right shift (>>>), and the binary code is shifted right to the specified number of digits. To the right shift, one digit is divided by 2, after the right shift, null uses '0' to supplement loop control: controls the outer loop. You can use tags (outer: for () {} break outer;) to terminate the outer loop: the label of the outer loop of the break jumps out of the outer loop: the label return of the outer loop of the continue: the method of the end loop break, return, and the statement System cannot be followed by the continue statement. out. print () can not pass the parameter System. out. print () parameters must be passed
First knowledge of java and how to compile

A java program has a main class file and multiple attached class files.
Unless your java program has only one public class helloworld, this is like only one helloworld. java.
Assume that your ImageViewer. java contains two classes: loadImage and showImage. After compilation, three classes are written. class file, which is ImageViewer. class and loadImage. class also has showImage. class; the file name is exactly the class Name of the class. why are there three? Because there is also a required public class.

Java Entry 1 · 2 · 3-an old bird's Java learning experience

No. I recommend you read a java entry book:
Crazy java handouts, carefully read and write code. Then let's look at java programming ideas.

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.