Basic Class Library Learning of Java

Source: Internet
Author: User

Java Basic Class Library:

(a), enter the relevant

Main (string[] args): setting input parameters

Input class; Scanner:scanner sc=new Scanner (system.in);

(ii) System-related classes

1,system class: Gets the environment variables and system properties of the current running platform

2,runtime class; Get the parameters of the JVM

(c), Common class

1,object class: Cloning Method (clone) is simply a simple copy of an object, not a pointer to the same object objects class: A tool class for the object class (that is, the object is handled as objects)

2,string,stringbuffer and StringBuilder class

The 1,string class is a constant, and once declared is immutable, stored in a constant pool, the intermediate process is prone to extra temporary variables.

The 2,stringbuffer class is mutable, thread-safe

The 3,stringbuilder class is mutable and thread is unsafe

4, execution speed on stringbuilder>stringbuffer>string

3,math class Math.random ()//is a method that is greater than or equal to 0.0 and less than 1.0 pseudo-random double value util. The random is a class (the former uses the latter to produce the method), and the Threadlocalrandom class is designed for multi-threading.

4,bigdecimal is designed for: double and float are prone to loss of precision in operations, and when new is a BigDecimal object, it is recommended to use the string type in the constructor method parameter instead of the double type (which guarantees accuracy).  Or you can construct the object with a. getValues (double num). DecimalFormat (Requirements for setting output format)

5, Time class:

The 1,data class creates a new class, which is equivalent to calling the System.currenttimemillis ()

2,calendar class, is abstract class

3,java8 has added a java.time package

(iv) Regular expressions

1, special character requirements:

2, pre-defined characters

3, square brackets expression:

    

4, Boundary match character

5, quantifier

6, instance: (Continue adding later ...) )

6.1: Mailbox: String regex= "\\w{3,20}@\\w+\\. (com|org|cn|net| gob) "

   

Basic Class Library Learning of Java

Related Article

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.