Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Static? Void? Trying to display date...O_o

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Static? Void? Trying to display date...O_o

    public class Date
    {
    private int month;
    private int day;
    private int year;

    public Date( int userMonth, int userDay, int userYear )
    {
    month = userMonth;
    day = userDay; // This section is responsible for establishing default values.
    year = userYear;
    }
    public void setMonth( int userMonth )
    {
    month = userMonth; // This is a set method for month.
    }
    public int getMonth()
    {
    return month; // This is a get method for month.
    }
    public void setDay( int userDay )
    {
    day = userDay; // This is a set method for day.
    }
    public int getDay()
    {
    return day;// This is a get method for day.
    }
    public void setYear( int userYear )
    {
    year = userYear; // This is a set method for year.
    }
    public int getYear()
    {
    return year; // This is a get method for year.
    }
    public void displayDate()
    {
    String Date = String.format( " %d\n/%d\n/%d\n", month, day, year );
    }
    public void main( String[] args )
    {
    System.out.print( "Enter the month number: " );
    month = input.nextInt();
    System.out.print( "Enter the day number: " );
    day = input.nextInt();
    System.out.print( "Enter the year number: " );
    year = input.nextInt();
    }
    }


    Everything seems to be working, except the italicized section. Any suggestions? The purpose of the program is to display the date in this format: 01/29/2012.

    Thanks Again!


  2. #2
    Junior Member
    Join Date
    Jan 2012
    Posts
    11
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default Re: Static? Void? Trying to display date...O_o

    I can't see which part is italicized or I would definetly try to help.

Similar Threads

  1. [SOLVED] unable to store, display date and time from db to extjs grid
    By VaniRathna in forum Java Servlet
    Replies: 3
    Last Post: November 16th, 2011, 09:36 AM
  2. public static void main(NewMember Mr_Bukkake){ }
    By Mr. Bukkake in forum Member Introductions
    Replies: 2
    Last Post: October 13th, 2011, 07:29 AM
  3. Need your help to display correct data by date
    By hanhtn in forum What's Wrong With My Code?
    Replies: 3
    Last Post: July 29th, 2011, 01:26 AM
  4. How to use SDF to display a future date.
    By amarettoCoffee in forum Object Oriented Programming
    Replies: 0
    Last Post: January 21st, 2011, 10:51 PM
  5. Calling a void method into a static void main within same class
    By sketch_flygirl in forum Object Oriented Programming
    Replies: 3
    Last Post: November 15th, 2009, 05:24 PM