Click here to watch in Youtube :
https://www.youtube.com/watch?v=XPzC2J44W14&list=UUhwKlOVR041tngjerWxVccw
ArrayDemo.java
Output
https://www.youtube.com/watch?v=XPzC2J44W14&list=UUhwKlOVR041tngjerWxVccw
ArrayDemo.java
class ArrayDemo { public static void main(String[] args) { // declares an array of shorts short[] shortArray; // allocates memory for 7 shorts shortArray = new short[7]; System.out.println("Length of the Array : " + shortArray.length); // initialize first element shortArray[0] = 300; // initialize second element shortArray[1] = 600; // and so forth shortArray[2] = 900; shortArray[3] = 150; shortArray[4] = 4500; shortArray[5] = 5000; shortArray[6] = 3000; System.out.println("Length of the Array : " + shortArray.length); } }
Length of the Array : 7 Length of the Array : 7
https://sites.google.com/site/javaee4321/java/ArrayDemolengthApp.zip?attredirects=0&d=1
See also:
No comments:
Post a Comment