For the complete documentation index, see llms.txt. This page is also available as Markdown.

JavaCast

Cast a variable to a specified Java type

Method Signature

JavaCast(type=[string], variable=[any])

Arguments

Argument
Type
Required
Description
Default

type

string

true

The name of a Java primitive or a Java class name.

variable

any

true

The variable, Java object, or array to cast.

Examples

Convert a Boxlang Number to a Java double primitive

Converts the number 180.0 degrees to radians using Java method: Math.toRadians(double degrees)

Run Example

createObject( "java", "java.lang.Math" ).toRadians( javaCast( "double", 180.0 ) );

Result: 3.141592653589793

Additional Examples

Run Example

Last updated

Was this helpful?