Java api ------ Object class, javajsonobjectapi

Source: Internet
Author: User

Java api ------ Object class, javajsonobjectapi

Java API is a Java Application programming Interface. It is a set of implemented standard classes provided by java. The Java API class library is a bit like a dll file in win32. It encapsulates many functions, does not provide specific entities, but only provides information such as method names and parameters. These class libraries can be used to conveniently and quickly implement various functions in the program. These can be divided into different sets based on different functions. Each set is combined into a package called a class library. Most of the class libraries in java are provided by Sun. These libraries are called Basic class libraries.

Common java packages: java. lang Package, java. io package, java. util package, java. swing package and java. awt package, java.net package, java. applet package, java. beans package. The specific applicability of these seven packages is not described.

 

Object Class

The Object class is the direct or indirect parent class of all classes in the java program, and is at the highest level of the class. If a class does not contain the keyword extends during declaration, the system considers that the class will directly inherit the Object class. The Object class contains the public attributes and methods of all java classes. These attributes and methods can be directly used in any class.

The Object class has a default constructor:

Public Object () {}// the method body is empty. This default constructor is called first when constructing a subclass Object.

Common Object methods:

Public Boolean equals (Object obj): returns true if two class variables point to the same Object.

Public final Class getClass () obtains information about the Class to which the current object belongs, and returns the Class Object

Public String toString () is converted to a String.

Protected Object clone () generates a backup of the current Object and returns a copy.

........

 

Example of the getClass method:

Class Name {} public class GetClassName {public static void main (String args []) {Name name = new Name (); System. out. println ("the class of the Object name is:" + (name. getClass ()));}}

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.