I am trying to put a date in my class which is 2 weeks ahead of the current date.
The problem is that is shows the date as april not may?
Any help would be much appreciated.
Thanks in advance
Below is the issue.class in question

[import java.util.*;

public class Issue {
Borrower borrower;
Item item;
String returnDate;

Issue(Borrower aBorrower, Item anItem)
borrower = aBorrower;
item = anItem;
// This should really be automatically generated based on the system date. The system date is showing 1 month behind?
GregorianCalendar now = new GregorianCalendar();
returnDate = "Return Date: " + now.get(GregorianCalendar.DAY_OF_MONTH) + "/" + now.get(GregorianCalendar.MONTH) + "/" + now.get(GregorianCalendar.YEAR);

public String b()
return borrower.toString();

public String i()
return item.toString();

public String getReturnDate()
return returnDate;

public static void main(String args[])
Borrower aBorrower = new Borrower("David","Leicester","BTEC Computing");
Item cItem = new Item("Mac User","Magazine");
Issue issue = new Issue(aBorrower, cItem);


Edited 3 Years Ago by happygeek: fixed formatting

read the documentation. And remember that in Java (as in all C inspired languages) indices are 0-based (and yes, there are some discrepancies in that, in Java as elsewhere).

This article has been dead for over six months. Start a new discussion instead.