Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (576)
games submitted by our members
Games in WIP (497)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Java 1.4.2, Calendar Bug (Gregorian Calendar).  (Read 1624 times)
0 Members and 1 Guest are viewing this topic.
Offline zappsweden

Junior Member




Java games rock!


« Posted 2006-03-24 10:24:04 »

Code
this.calendar=new GregorianCalendar(7, 7, 7);
    System.exit(calendar.MONTH);


Process finished with exit code 2. Year, Month, Day should all be set to 7, so why this strange exit code?
Offline c_lilian

Senior Member


Projects: 1


Java games will probably rock someday...


« Reply #1 - Posted 2006-03-24 10:26:35 »

hehe... calendar.MONTH == Calendar.MONTH wich is the field name to get the month of of a calendar instance (calendar.get(Calendar.MONTH)) would return 7

Lilian

Offline zappsweden

Junior Member




Java games rock!


« Reply #2 - Posted 2006-03-24 10:41:32 »

Thanks   Smiley

One day we think we understand software code but the next day the brain play tricks on us again Cheesy
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Mr_Light

Senior Member




shiny.


« Reply #3 - Posted 2006-03-24 16:34:38 »

by java convention all caps indicates a constant.

anyways why are you using system.exit() differendly put why would you want you abnormal exit code to equal number of a month. Huh

It's harder to read code than to write it. - it's even harder to write readable code.

The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
Offline zappsweden

Junior Member




Java games rock!


« Reply #4 - Posted 2006-03-24 21:11:40 »

The System.exit was for error testing purpose. Wanted to know what numbers I got.
Offline Kova

Senior Member





« Reply #5 - Posted 2006-03-25 00:54:25 »

The System.exit was for error testing purpose. Wanted to know what numbers I got.
Huh
System.out.println(calendar.month);
Offline Fred304

Junior Newbie





« Reply #6 - Posted 2006-04-15 18:59:57 »

1  
2  
3  
4  
5  
6  
7  
    /**
     * Field number for <code>get</code> and <code>set</code> indicating the
     * month. This is a calendar-specific value. The first month of the year is
     * <code>JANUARY</code> which is 0; the last depends on the number of months in a year.
     *
     */

    public final static int MONTH = 2;

Offline Anon666

Junior Member




aka Abuse/AbU5e/TehJumpingJawa


« Reply #7 - Posted 2006-05-07 04:42:07 »

That class needs retrofitting to use an Enum  Roll Eyes
Offline Mr_Light

Senior Member




shiny.


« Reply #8 - Posted 2006-05-07 12:16:16 »

it does? I don't beleave 1.4 had enums  Wink

setting the tpic name aside, there is so much thats avail in 1.5 that isn't used in the api, none of the swing components use genetircs for example. all in due time I gues.

It's harder to read code than to write it. - it's even harder to write readable code.

The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (12 views)
2014-04-15 18:08:23

BurntPizza (11 views)
2014-04-15 03:46:01

UprightPath (24 views)
2014-04-14 17:39:50

UprightPath (10 views)
2014-04-14 17:35:47

Porlus (27 views)
2014-04-14 15:48:38

tom_mai78101 (49 views)
2014-04-10 04:04:31

BurntPizza (108 views)
2014-04-08 23:06:04

tom_mai78101 (208 views)
2014-04-05 13:34:39

trollwarrior1 (176 views)
2014-04-04 12:06:45

CJLetsGame (182 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!