Java Beginner 2

Source: Internet
Author: User

1. Packing class

Java advocates all things are objects, but the data type of the division of the basic data type and reference data type, then how can we call the basic data type object? (1) In addition to the integer and character definitions of the name and the corresponding basic type of the difference is large, the other six are capitalized on the first letter. (2) Integer,byte,float,double,short,long are subclasses of the number class. (The number class is followed); (3) both character and Boolean are object direct subclasses, and (4) 8 classes are final decorated (not inheritable).put the basic data type → wrapper class:• Implemented by the construction method of the corresponding wrapper class • In addition to character, other wrapper classes can pass in a string parameter to build the wrapper class object.packaging classes → basic data types• Example methods for packaging classes xxxvalue (); XXX Indicates the basic data type corresponding to the wrapper class
boolean bool = false; Boolean b2 = new Boolean (bool), Integer i = new Integer (3), int i2 = I.intvalue (); Boolean B1 = new Boolean ("TRue");//trueboolean b2 = B1.booleanvalue (); float f = new float ("3.14"),//3.14integer i2 = new Integer ("123s");//numberformatexception

2.

Java Beginner 2

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.