w3resource

Javascript : Java object, JavaArray, JavaClass, JavaObject, JavaPackage, Packages, sun, netscape

Java object

Java object is a top-level, predefined JavaScript object used to access java classes.

JavaArray

Javaarray object is an instance of a java array.

Can be created by any java method which creates an array or by using newInstance method of the array class.

JavaClass

A JavaScript reference to a Java class.

Can be created by a reference to the class name used with the Packages object.

JavaObject

The type of a wrapped Java object accessed from within JavaScript code.

Any Java method which returns an object type. In addition, you can explicitly construct a JavaObject using the object's Java constructor with the Packages keyword: new Packages.JavaClass(parameterList) where JavaClass is the fully-specified name of the object's Java class.

JavaPackage

A JavaScript reference to a Java package.

Can be created with a reference to the package name used with the Packages keyword.

Packages, sun, netscape

Packages

Packages is a built-in object used to access Java classes from within JavaScript code.

Syntax>

Packages.packagename

Properties of the Packages object

Name Description
classname Name of Java class in a package.
java Represent the core Java classes.
netscape Represent a set of Netscape classes.
sun Represent the core Sun classes

sun

The sun object is predefined JavaScript object,is used to access any Java class in the package sun.*.

netscape

The netscape object is predefined JavaScript object, used to access any Java class in the package netscape.*.

Can be created by a reference to the class name used with the Packages object.

Previous: JavaScript valueOf() Method: String Object
Next: JavaScript: HTML Form Validation



JavaScript: Tips of the Day

JavaScript: Destructuring with Aliases

The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables. Rather than sticking with the existing object variable, we can rename them to our own preference.

const object = { number: 10 };
// Grabbing number
const { number } = object;
// Grabbing number and renaming it as otherNumber
const { number: otherNumber } = object;
console.log(otherNumber); //10

Ref: https://bit.ly/3adlwNy