In this Tutorial we make a simple example to understand Get Length of Array in Java Script. In this code we import a package java.util and java. text.
Packages used in code -
1)Java.util. - This includes the collections framework, legacy collection classes, event model, date and time facilities and internationalization..
2)Java.text - This includes the classes and interfaces used for handling text, dates, numbers, and messages.
Methods used in code -
1)Format formatter = new SimpleDateFormat("MMMM") -
This method return you a SimpleDateFormat, this allows for formatting (i.e.,
date -> text), parsing (text -> date), and normalization. The date is
represented as a
Date object or the milliseconds since January 1,
1970, 00:00:00 GMT.
2)Calendar.get Instance( ) - This method return you the default time zone and current locale.
We declare a variable string array name month, that is used to instantiate an string object with initial size to hold 12 element. The for loop execute and run the script till the length i is less than length of string element.
3)Calendar.set(calendar.Month,i) - This method set you the calendar month.
4)calendar.gettime( ) -This method get you the calendar current time.
5)monthname.length ( )-This method return you the length of the month.
The var month instantiate an array object that hold the size of month. The for loop run and execute the script till the length of i is less than month. The document. write print the list of month in a year.
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: November 11, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles