Monday, 26 October 2015

Java Tutorial : Java Array (length)


Click here to watch in Youtube : 
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);

    }
}
Output
Length of the Array : 7
Length of the Array : 7
To Download ArrayDemolengthApp Project Click the below link
https://sites.google.com/site/javaee4321/java/ArrayDemolengthApp.zip?attredirects=0&d=1

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • No comments:

    Post a Comment