On Sat, 05 Oct 2002 22:51:00 +0200, rofe wrote:
> public class Month
> {
> private int monthNr; /* the month number given by the user */
> private String months[] = new String[12]; /* the month array */
>
> /* the months */
> months[0] = "Januar";
> months[1] = "Februar";
> months[2] = "Marts";
> months[3] = "April";
> months[4] = "Maj";
> months[5] = "Juni";
> months[6] = "Juli";
> months[7] = "August";
> months[8] = "September";
> months[9] = "Oktober";
> months[10] = "November";
> months[11] = "December";
>
> public Month(int monthNr)
> {
> this.monthNr = monthNr;
> }
>
> public String getName()
> {
> return months[monthNr - 1];
> }
> }
>
> m v h
> Ronni
> rofe@mailme.dk
Hej Ronni
Du kan enten flytte din tildelinger (months[0]=..months[11]=) ned i din
konstruktør eller sætte {} omkring. Dvs.
/* the months */
{
months[0] = "Januar";
months[1] = "Februar";
....
months[11] = "December";
}
Håber du kan bruge det til noget
--
Mikkel Bundgaard
Student at IT University of Copenhagen
http://officehelp.gone.dk
Codito, Ergo Sum