Java Utility Class

Source: Internet
Author: User

Java Utility Class

The 1.File class provides methods for managing files and directories whose objects represent a file or directory. It provides several ways to manipulate a file or folder. The list () method and the Listfiles () method can play a role in locating a specific file.

The 2.Object class, which is the ancestor of all Java classes, inherits directly from the Objetc class if a class declaration does not contain the extends keyword. There are many important ways of doing this:

Equals (), notify (), Notifyall (), Wait (), Hashcode (), toString (). Finalize ()

3.String classes, immutable classes, some of the methods that appear to be able to change a string are created with a new string with the attributes given by the method. The StringBuffer class is a string buffer class, variable.

The string class overrides the Equals () method of the object class, and StringBuffer does not. The ToString () method of the string class is to return a reference to the current string instance itself, whereas the ToString () method of the StringBuffer class returns a reference to the new string object for all the character contents in the current buffer. Using StringBuffer can reduce the number of times a JVM creates a string object, reducing the number of dynamically allocated and reclaimed memory, and improving program performance.

There are three methods in the 4.String class for regular expressions, split (), ReplaceAll (), Replacefirst ().

5. Packing Type:

1) Function: Provides a series of practical methods. You can only use wrapper classes when you hold the base data type in the collection.

2) Construction Method:

Constructs a parameter using its base data type.

In addition to the character class, other wrapper classes can be constructed with a string.

When constructing a Boolean type, the resulting Boolean type is false unless true.

3) Common methods:

All override the ToString () method to return the base type data represented by the wrapper object as a string.

The number class has a static factory method of valueof (String s). You can parse a string into a wrapper class.

The number class has a static factory method of Parsexxx (string s), which resolves the string to the base data type.

4) The wrapper class is a final type, has no subclasses, and is an immutable class.

Class 6.Math: Mathematical Operations class

Class 7.Random: Generating random numbers

8.Data class: The number of milliseconds to represent a specific date. Sysout (new Date ()) returns the system date

9.DataFormat class: Format for customizing dates.

10.Calendar class: Sets and reads part of a date.

11.BigDecimal class: Accurate calculation.

Java Utility Class

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.