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