Java--api

Source: Internet
Author: User

One, Object

The object class is a superclass of all classes, and all classes inherit directly or indirectly from object

1. How to get a byte-code object

GetClass ()

Class name.

Class.forName

2. ToString Method

Returns the address value of an object in memory, which can be overridden to represent the string form of an object

3. Equals method

      The Equals method, which is used to compare two objects, is actually compared with the memory address of two objects. the Equals method inside the object class is used internally by the = = comparison operator.

in development, to compare two objects is the same, often based on the value of the property in the object comparison, that is, in development often requires subclasses to override the Equals method to compare the property values of the object.

Second, System class

The system class contains some useful classes and fields that cannot be instantiated

1. static void Arraycopy (object src, int srcpos, object dest, int destpos, int length):

Copy length elements starting from the Srcpos index of the SRC source array

Place these elements in the dest array starting from the destpost position

2. Static Long Currenttimemillis ()

Millisecond value from midnight January 1, 1970 to current system time

3. static void exit (int status)

Terminating a running Java Virtual machine

4. static void GC ()

Run the garbage collector, the virtual machine has tried its best (not necessarily recycled) to reclaim space from all discarded objects

The Finalize () method that invokes object when the recycle succeeds

Third, date-related classes

  1. Date class

(1) Construction method

Date () Creates a Date object for the current system time

Date (long date) creates a time object with a value of 00:00:00date milliseconds from January 1, 1970

2. DateFormat class & SimpleDateFormat

      DateFormat is an abstract class of date/time formatting subclasses that formats and resolves dates or times in a language-independent manner.

Date/time formatting subclasses (such as the SimpleDateFormat class ) allow formatting (that is, date -and text), parsing (text-to-date), and normalization.

(1) String format (date date)

Convert Date to String

(2) Date Parse (String source)

Converts a date in string form to a type of date

  

Java--api

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.