Java Programming Idea (i) Summarize __ programming

Source: Internet
Author: User
Chapter II Everything is an object
2.1 Reference Action Object

For security purposes, you create a reference and initialize it.
String S=new string ("asdf");
The new operation creates a novel string object, s reference to this object

2.2 must be created by you all objects
2.2.1 6 Data storage areas
Register Device:
Within the CPU, resources are limited by the compiler on demand, the fastest speed.
Stack:
In Universal RAM, the stack pointer moves down to allocate new memory, while moving up frees up memory, but the Java compiler must know the size and lifecycle of all of the data, the speed behind the registers, the base data type and the reference stored here.
Heap:
Located in the Ram area for all Java objects, the compiler does not have to know the data size and lifecycle
Static storage:
In the Ram area, static storage holds the data that the program has been running
Constant storage:
Data content will never change
Non-RAM storage:
Live completely outside the program, not under any control of the program

9 Basic types of 2.2.2
Basic type Size Minimum value Maximum Value Wrapper type
Boolean - - - Boolean
Char 16-bit Unicode0


Unicode 216-1

Character
Byte 8-bit -128 +127 Byte
ShoRT 16-bit

-215


+215-1

Short
Int 32-bit


-231


+231-1

Integer
Long 64-bit


-263


+263-1

LOng
Float 32-bit IEEE754 IEEE7 Float
Double 64-bit IEEE754 IEEE7 Double
void - - - Void

High-precision digital BigInteger and bigdecimal encapsulate int and float operations respectively

An array of 2.2.3 Java
int a[]=new int[3];//like creating an array

2.3 Never destroy objects
Scope: The space in which an object can be used
Life cycle: Save time in memory
Class data: As an entire class exists DEMO.D, only one storage space, change all objects visible
Class method: As an entire class exists DEMO.F (), only one storage space

2.4 Coding Style
Class name first letter, using hump naming

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.