Public class j1 {
/**
* @ Param args
*/
Public static void main (String [] args ){
// TODO Auto-generated method stub
String [] books = new String []
{"Java", "javaee", "ajax", "xml ",
};
String [] names = {
"1", "2", "3 ",
};
String [] atrArr = new String [5];
System. out. println ("first" + books. length );
System. out. println ("two" + names. length );
System. out. println ("third" + atrArr. length );
Books = names;
AtrArr = names;
System. out. println ("\ n \ nfirst" + books. length );
System. out. println ("two" + names. length );
System. out. println ("third" + atrArr. length );
Books [1] = "kid ";
System. out. println ("----------------");
System. out. println ("books Second:" + books [1]);
}
}
----------------- Javascript Array
<Html>
<Head>
<Title> </title>
</Head>
<Body>
<Script type = "test/javascript">
Var arr = [];
Document. writeln ("arr length:" + arr. length + "<br/> ");
Arr [2] = 6;
Arr [10] = "handsome guy ";
Arr [12] = 2;
Arr [18] = "44 ";
Document. writeln ("arr length:" + arr. length + "<br/> ");
</Script>
</Body>
</Html>
-------------------
JAVA cannot automatically increase memory space.
JAVASCRIPT can automatically increase the memory space.
--------------------
Public class j1 {
/**
* @ Param args
*/
Public static void main (String [] args ){
// TODO Auto-generated method stub
String [] books = new String []
{"Java", "javaee", "ajax", "xml ",
};
String [] names = {
"1", "2", "3 ",
};
String [] atrArr = new String [5];
System. out. println ("first" + books. length );
System. out. println ("two" + names. length );
System. out. println ("third" + atrArr. length );
Books = names;
AtrArr = names;
System. out. println ("\ nfirst" + books. length );
System. out. println ("two" + names. length );
System. out. println ("third" + atrArr. length );
Books [2] = "kid ";
AtrArr [2] = "It doesn't matter ";
System. out. println ("----------------");
System. out. println ("books Second:" + books [1]);
System. out. println ("first" + books. length );
System. out. println ("two" + names. length );
System. out. println ("third" + atrArr. length );
System. out. println ("third" + atrArr [2]);
}
}
------------- Out
First 4
Two 3
Third 5
First 3
Two 3
Third 3
----------------
Books Second: 2
First 3
Two 3
Third 3
Third doesn't matter
----------------------- Javascript
<Html>
<Head>
<Title> </title>
</Head>
<Body>
<Script type = "test/javascript">
Var arr = [];
Document. writeln ("arr length:" + arr. length + "\ n ");
Arr [2] = 6;
Arr [10] = "handsome guy ";
Arr [12] = 2;
Arr [18] = "44 ";
Document. writeln ("arr length:" + arr. length );
</Script>
</Body>
</Html>
---------------- Out
0
19