Please help me? As I am new with Java and I have tried a lot but I am not able to pass this one. This is compiled without errors but not accepted for testing as they ask to cut down at least by half too much text and now I am unable to solve this

public class Solution
{
    public static void main(String[] args)
    {
        System.out.println("24/2/3111");
    }
}

asked 22 Feb '15, 14:12

Rida%20Irfan's gravatar image

Rida Irfan
2113
accept rate: 0%

edited 23 Feb '15, 06:24

Diego%20Carleone's gravatar image

Diego Carleone ♦♦
7616


In the task you are asked to display only current year, not the whole date. Because the game takes place in 31st century, you need to dispay current year + 1000.

And read this: http://help.javarush.net/questions/6/everyone-read-how-to-format-the-code

link

answered 23 Feb '15, 06:23

Diego%20Carleone's gravatar image

Diego Carleone ♦♦
7616
accept rate: 83%

It should display the current year, soo we need to get the year from calendar object by int year = Calendar.getInstance().get(Calender.YEAR); to get the 31st century, we do (year+1000)

link
This answer is marked "community wiki".

answered 03 Mar '15, 12:12

Nethikopula%20Divya's gravatar image

Nethikopula ...
11
accept rate: 0%

Tip: Replace the century of the current year with 31. You have to display a four-digit number.

If we add 2019 + 1000 it will make 3019, and it won't start with 31

link

answered 31 Jan, 01:56

Java_eater's gravatar image

Java_eater
1
accept rate: 0%

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:

×13
×4
×3
×2

Asked: 22 Feb '15, 14:12

Seen: 4,430 times

Last updated: 31 Jan, 01:56