Displaying Months in Java

File  Name:  Month.java
Description:
Output:  Displaying  months  in  proper  order

Program:

public  class  Month{

public  static  void  main(String  args[]){

String[] month = {"January","February","March","April"};
for(int i = 0;i<month.length;++i){ System.out.println(month[i]);

}
}
}
 
 

File  Name:  Month2.java

Program:

public  class  Month2{

public  static  void  main(String  args[]){
//String[] month={"Jan","Feb","Mar","Apr"} int[] month = {1,2,3,4,5};
for (int i=0;i<month.length;++i){ System.out.println(month[i]);

}
}
}

Do you have a Java Problem?
Ask It in The Java Forum

Java Books
Java Certification, Programming, JavaBean and Object Oriented Reference Books

Return to : Java Programming Hints and Tips

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site www.erpgreat.com is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.