Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Java Get Method 
 

In this example you will learn how to use the get method in Java.

 

Java Get Method

                         

In this example you will learn how to use the get method in Java.

Java provides various methods and functions that makes this language easy to learn and use. So just go through the below given example code to see when and how to use get method in Java. 

The example is going to show the date details.. including year, date and month etc.. with the use of get method.

 

 

Code for Java Get Method

import java.util.Calendar;
public class GetMethod  {
 public static void main(String[] av) {
   Calendar cal = Calendar.getInstance(); 
    System.out.println("Year: " + cal.get(Calendar.YEAR));
    System.out.println("Month: " + cal.get(Calendar.MONTH));
    System.out.println("Day: " + cal.get(Calendar.DAY_OF_MONTH));
    System.out.println("Day of week = " + cal.get(Calendar.DAY_OF_WEEK));
    System.out.println("Day of year = " + cal.get(Calendar.DAY_OF_YEAR));
    System.out.println("Week in Year: " + cal.get(Calendar.WEEK_OF_YEAR));
    System.out.println("Week in Month: " + cal.get(Calendar.WEEK_OF_MONTH));
    System.out.println("Day of Week in Month: "
        + cal.get(Calendar.DAY_OF_WEEK_IN_MONTH));
    System.out.println("Hour (24-hour clock): "
        + cal.get(Calendar.HOUR_OF_DAY));
    System.out.println("Minute: " + cal.get(Calendar.MINUTE));
    System.out.println("Second: " + cal.get(Calendar.SECOND));
  }
}

Output will be displayed as:

Download Source Code

                         

» View all related tutorials
Related Tags: java c memory time application object io runtime free method get order return this sso ai app with to run

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

1 comments so far (
post your own) View All Comments Latest 10 Comments:

hi i want get the own system default gateway in java .

Posted by anand on Wednesday, 12.17.08 @ 22:23pm | #82898

Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.