Hi people, can you please help find my mistake. My code doesn't pass testing.

public class Solution
{
    public static void main(String[] args)
    {
        //add your code here
        Date now = new Date(6,8,1988);
        System.out.println(now);
    }
    public static class Date{
            int day ;
            int month;
            int year;
        public Date(int day, int month, int year){
            this.day= day;
            this.month=month;
            this.year=year;
        }
    }
}

asked 01 Oct, 04:43

aleksander's gravatar image

aleksander
112
accept rate: 0%

edited 01 Oct, 04:49


Hi! In this task we need for current date

Test passed:

import java.text.SimpleDateFormat; import java.util.Date;

public class Solution { public static void main(String[] args) { Date date = new Date(); SimpleDateFormat format = new SimpleDateFormat("dd MM yyyy"); System.out.println(format.format(date)); } }

link

answered 10 Oct, 09:51

denisros's gravatar image

denisros
11
accept rate: 0%

edited 10 Oct, 10:10

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×31
×22
×14

Asked: 01 Oct, 04:43

Seen: 104 times

Last updated: 10 Oct, 10:10