BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 03-15-2008, 10:38 AM   #1
MrCmonster
New Member
 
MrCmonster's Avatar
 
Join Date: Jan 2008
Location: Southern Colorado, USA
Model: 8310
PIN: N/A
Carrier: AT&T
Posts: 12
Question No enum keyword?

Please Login to Remove!

Is it just me, or is there no enum keyword available for BB apps? What do you use instead? I looked at java.util. Enumeration, but that isn't what I want at all.

I want something like:
Code:
public enum Day {
    SUNDAY, MONDAY, TUESDAY, WEDNESDAY, 
    THURSDAY, FRIDAY, SATURDAY 
}
Thanks for any help!
David
Offline  
Old 03-15-2008, 11:11 AM   #2
MrCmonster
New Member
 
MrCmonster's Avatar
 
Join Date: Jan 2008
Location: Southern Colorado, USA
Model: 8310
PIN: N/A
Carrier: AT&T
Posts: 12
Default

Well looks like I found the answer to my problem...
J2ME does not have support for the enum statement. UGH!

So I guess I'll just do a bunch of:

Code:
private static final int XXX_YYY = 0;
private static final int XXX_ZZZ = 1;
etc.
Offline  
Old 03-15-2008, 02:40 PM   #3
sn0wshrew
Knows Where the Search Button Is
 
Join Date: Sep 2007
Model: 8830
PIN: N/A
Carrier: Verizon
Posts: 24
Default

Yeah, it's based on crufty ol' Java 1.4. And will be... until the end of time?!
Offline  
Old 03-16-2008, 05:40 AM   #4
bdowling
Thumbs Must Hurt
 
Join Date: Jan 2007
Model: 8800
Carrier: Orange
Posts: 181
Default

A better way to do it (that having a load of ints) is just to create a class:

Code:
public class Day
{
    private String name;
    private Day(String name)
    { this.name = name }

    public Static SUNDAY = new Day("Sunday");
    public Static MONDAY = new Day("Monday");
    ...
}
Then you can be sure that Day.MONDAY only every == Day.MONDAY, and that you actually have a Day, rather than just a number being passed to you.
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Original New DEC Digital DCJ11-AE 57-19400-09 Vintage CPU x 1pc picture

Original New DEC Digital DCJ11-AE 57-19400-09 Vintage CPU x 1pc

$100.00



DEC / AMI 304E 21-15542-01 vintage ceramic IC - KTF11 Chip *NEW* 40278101  picture

DEC / AMI 304E 21-15542-01 vintage ceramic IC - KTF11 Chip *NEW* 40278101

$50.00



Vintage Journal Beautiful Garden Flower Embossed Leather-Antique Handmade Dec... picture

Vintage Journal Beautiful Garden Flower Embossed Leather-Antique Handmade Dec...

$27.91



Vintage DEC PDP11 Option Bulletin KX11-C Real-Time Clock 1981 picture

Vintage DEC PDP11 Option Bulletin KX11-C Real-Time Clock 1981

$4.95



Dec/Adac Corp. D4-10390 Rev 6 Model 1664ATTL Output Pulse Board 1983 (B16) picture

Dec/Adac Corp. D4-10390 Rev 6 Model 1664ATTL Output Pulse Board 1983 (B16)

$189.99



VINTAGE Bruker Board DEC W4P3042 for SpectroSpin 250 picture

VINTAGE Bruker Board DEC W4P3042 for SpectroSpin 250

$50.00







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.