Get started with Java 02

Source: Internet
Author: User

The effect of 1:JDK,JRE,JVM on the relationship
(a) role
JVM: providing Java Cross-platform
Jre:java Operating Environment
Jdk:java Development environment
(ii) relationship
Jdk:jre+tools
Jre:jvm+ class
2.JDK Download and Installation
Green version of the Software: installation as long as the folder can not be written to the registry
3. Keywords: is generally recognized as green lowercase has a specific meaning of words such as: void (yes)--main (not This is special only name) about 50 keywords
4. identifiers: names for classes, interfaces, methods, variables, etc.
Composition Rules: numbers, characters, $,_ composition
Note: cannot be a keyword; it cannot be the beginning of a number
See what names are legal: helloword,dataclass,_983, $bs 5,class,98.3,hello Word
class, interface: First Letter uppercase dog; method variable: first letter lowercase, multiple words capitalized from the first character of the second word: Showmyapp (); constants: all uppercase
5. There are 6 types of constants: string constants, integer constants, fractional constants, character constants, Boolean constants, empty Constants
Java has four representations of integer constants: binary (beginning with 0b), octal (0), decimal, hexadecimal (beginning with 0x)
6. Code Anti-code complement
The inverse code of positive number is the same as the original code, and the inverse code sign of negative numbers is the same as the source;
The complement of positive numbers is the same as the original code; the complement sign of negative numbers is the inverse code plus 1.

Value Source Anti-code Complement
7 0 0000111 0 0000111 0 0000111
-7 1 0000111 1 1111000 1 1111001


7. Data Type:

Value type, which is how the buyers heap handles data types and knows how it works Inside.
8. Type Conversion:
Boolean cannot be converted to a different data type
Default Conversion: byte,short,char--int--long--double
Byte,short,char conversions are first converted to the int type.
Forcing type conversions
The byte range is 128 to 127 and will be an Error.
+: generally first operation, in consideration of type (see if the range of the type is Exceeded)
8. Scope
9. Keyboard Entry:
(a) Guide package: Import Java.util.Scanner
(ii) creation of the object: Scanner sc=new Scanner (system.in);
(iii) acquisition of Data: int A=sc.nextint ();

10. Object-oriented Production Manual
(a) requirements: The class file that others give to each method needs to be known by the user
(ii) step: A. Write a tool class
B. Adding a document comment (must have public document comments to be recognized)
C. Parsing document annotations with tools
D. format: javadoc-d Directory-version-author Arraytool.java
(c) end: get an HTML page on this tool class introduction
We can use it whenever we have a class and a manual.
11. code block
(a) definition: The code enclosed in Java {} is a block of Code.
(ii) classification: Classification According to the location of the code block
A. Local code block: local location for defining variable periods
B. Constructing a code block: constructs a block of code before each invocation of the construction method
C. Static code block: the position of a member in a class, except with the static modifier
(c) sequencing: static > Construction > local; where static executes only one at a time; construction executes every time
12. Inheritance
(a) advantages: reusability, repeatability, The relationship between classes and classes
(ii) Disadvantages: increased coupling between classes
13. Method Overrides
(a) precautions: A. Parent class private variable cannot be overridden
B. When a subclass overrides a parent class, the permissions cannot be low
C. Parent class static method subclasses must be overridden by static methods
anyway, It's the surest thing to be consistent with the parent class.
(ii) the difference between method overrides and method Overloads: one is the method body is different and inherits from the parent class, and the other is the parameter change method body.
It's Changed.
(iii) Final: reference to the final keyword when a method in the parent class does not cover the quilt class
How to use: add a modifier to the Final: subclass cannot be overridden;
Modifier range: class, method, variable
Note: modifier value Type: value cannot be changed
Reference Type: address value cannot be changed
API (application Programming Interface) application Programming interface is the help document

14. Polymorphic
(i) Meaning: The different states that the same object manifests in a different state
(ii) implementation Prerequisites: A. To have an inheritance relationship
B. To have a method rewrite
C. Parent class reference to child class parent F=new child ();


Some knowledge points to be aware of
0. annotations can be used to debug programs with more advanced debuggers

1. No main is a Non-startup class or a non-startup method; there are multiple classes of Java files when there are only one main method

2. object-oriented three main features: encapsulation, inheritance, polymorphism

3. Variable size open space is determined by the data type

4. Keywords: automatically open space to the computer
Reserved word: cannot allocate space to computer memory
Disclaimer: No open space
Definition: the computer is open space

5. What can be done with one instruction do not waste space with a lot of words

6.stu.said (): where "." Object Method Accessors

7. What are the differences between classes and objects? Object: See see touch, class: can't see touch

8. What is the object creation process? You can fill in the comments section

9. The program is composed of multiple instructions

There is only one public class present in the 10.java file

11. The default constructor for a class is not even void

12. Creating anonymous Class Objects: class objects in the cache area of the CPU are uploaded to the console

13.java file name must be class name when public modifies class

Get started with Java 02

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.