[Java Study Notes] Several remark classes

Source: Internet
Author: User

Author: gnuhpc
Source: http://www.cnblogs.com/gnuhpc/

1. The file class provides methods for Managing Files And Directories. Its Objects represent a file or directory. It provides several methods to operate files or folders. The List () method and listfiles () method can be used to locate a specific file.

 

2. The object class is the ancestor of all Java classes. If a class declaration does not contain the extends keyword, it directly inherits from the objetc class. There are many important methods:

Equals (), notify (), policyall (), wait (), hashcode (), tostring (). Finalize ()

 

3. string class, non-variable class. Some methods that seem to be able to change the string actually create a new string with the features granted by the method. The stringbuffer class is a string buffer class and variable.

The string class overwrites the equals () method of the object class, but the stringbuffer does not. The tostring () method of the string class returns the reference of the current string instance, while the tostring () of the stringbuffer class () the method returns a reference to the New String object of all characters in the current buffer. Using stringbuffer can reduce the number of times that JVM creates string objects, reduce the number of times that memory is dynamically allocated and recycled, and improve program performance.

 

4. The string class contains three methods for regular expressions: Split (), replaceall (), and replacefirst ().

 

5. Packaging:

1) Role: provides a series of practical methods. Only the packaging class can be used to store basic data types in a collection.

2) constructor:

Use its basic data type for parameter construction.

Except the character class, other packaging classes can be constructed using a string.

When constructing a boolean type, the boolean type is false unless it is true.

3) common methods:

 

The tostring () method is overwritten, and the basic type data represented by the wrapped object is returned as a string.

The number class has the valueof (string s) Static factory method. You can resolve a string to a packaging class.

The number class has a static factory method of parsexxx (string s). You can resolve the string to the basic data type.

4) The packaging class is of the final type and has no subclass and is an immutable class.

 

6. Math class: mathematical class

 

7. Random class: generate a random number

 

8. Data class: indicates a specific date in milliseconds. Sysout (new date () returns the system date

 

9. dataformat class: Used to customize the date format.

 

10. Calendar class: Set and read part of the date.

 

11. bigdecimal class: precise computing.

 

Author: gnuhpc
Source: http://www.cnblogs.com/gnuhpc/

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.