JavaMethod ObjectNameJavaMethod Object---JavaScript representation of a Java methodSynopsis
javamethod(...) invoke an instance method DescriptionThe JavaMethod object is a JavaScript representation of a Java method. It is the part of LiveConnect that implements the functionality that allows JavaScript to invoke class and instance methods accessed through the JavaClass and JavaObject objects. See Chapter 19, LiveConnect: JavaScript and Java for full details. UsageBear in mind that Java is a typed language. This means that the arguments passed to a JavaMethod must be compatible with the type of the expected arguments. If arguments of the wrong type are passed, a JavaScript error will occur. Examplejava.lang is the name of a JavaPackage. It contains the JavaClass java.lang.System This class has a property out which is an JavaObject. This JavaObject has a property println, which is a JavaMethod. LiveConnect allows us to invoke this Java method using JavaScript syntax with code like the following:
java.lang.System.out.println("Hello from Java!"); |
|