JavaScript getclass () function

Source: Internet
Author: User

Definition and usage

The GetClass () function returns a Javaobject javaclass.

Grammar
GetClass (Javaobj)
The parameter description javaobj a Javaobject object.
return value

The Javaclass object of the Javaobj.

Description

The function accepts a Javaobject object as its argument and returns the Javaclass of the object, which returns the Javaclass object. The Javaclass object represents the Java class of the Java object, and the Java class represented by the Java object is specified by Javaobject.

Customary usage

Please do not confuse the getclass () function of JavaScript with the GetClass method of all Java objects. Don't confuse JavaScript's Javaclass object with the Java Java.lang.Class class.

Take a look at the following line of code, which creates a Java Rectangle object:

var new java.awt.Rectangle ();

obj is a JavaScript variable that holds javaobject. We can call the JavaScript function getclass () to return a Javaclass object that represents the Java.awt.Rectangle class:

var cls = getclass (obj);

Java GetClass () is called differently and performs a completely different function:

CLS = Obj.getclass ();

After executing this line of code, the CLS is a Java object that represents the Java.lang.class object. This Java.lang.class object is a Java object, which is a Java representation of the Java.awt.Rectangle class.

Finally, for any javaobject obj, you do see that the following expression is always true:

(GetClass (Obj.getclass ()) = = Java.lang. Class)

JavaScript getclass () function

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.