nashorn/docs/JavaScriptingProgrammersGuide.html
changeset 16522 d643e3ee819c
parent 16212 363737d0d757
child 16784 ba0dd689dd98
--- a/nashorn/docs/JavaScriptingProgrammersGuide.html	Wed Jul 05 18:46:02 2017 +0200
+++ b/nashorn/docs/JavaScriptingProgrammersGuide.html	Tue Mar 12 18:12:42 2013 +0530
@@ -533,9 +533,8 @@
 <hr>
 <a name="jsarrays" id="jsarrays"></a>
 <h3>Creating, Converting and Using Java Arrays</h3>
-<p>While creating a Java object is the same as in Java, to create
-Java arrays in JavaScript we can use Java reflection
-explicitly. But once created the element access or length access is
+<p>
+Array element access or length access is
 the same as in Java. Also, a script array can be used when a Java
 method expects a Java array (auto conversion). So in most cases we
 don't have to create Java arrays explicitly.</p>
@@ -543,7 +542,8 @@
 // <a href="source/javaarray.js">javaarray.js</a>
 
 // create Java String array of 5 elements
-var a = java.lang.reflect.Array.newInstance(java.lang.String.class, 5);
+var StringArray = Java.type("java.lang.String[]");
+var a = new StringArray(5);
 
 // Accessing elements and length access is by usual Java syntax
 a[0] = "scripting is great!";