🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #19235

Re: Lack of enumerated types

#19235
From: Rich Wilkman
Date: Thu, 26 Feb 1998 00:00
45 lines
1983 bytes
Peter:

I just use static constants and arrays in an interface.  It ain't
enums but it's better then a sharp stick in the eye.  There are some
other approaches in the java.lang.* faq and some third party folks
have claimed to implement enum like behaviour.

What I do...

public interface FavoriteConstants{
  static final int PI = 4;
  static final int e = 2;
  static final String mathGrade = "F";
  static final String[] daysInWeek = {"Sun","Mon","Tue","Fri"};
}

then

publc class foo extends Bar implements FavoriteConstants{}

-Rich

Peter Steele wrote:
> 
> One language feature that I already miss in Java is enumerated types. I've
> always used enumerated types, from Pascal to C to C++ and even in Visual
> Basic 5.0. They avoid having to use explicit numeric constants. Very very
> useful. I've found ways to fake it but it sure isn't as clean as an
> enumerated type. What do others do to get around this language omission?

-- 

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Rich Wilkman
Senior Quality Assurance Engineer
Borland JBuilder Team

If you see something that looks like an opinion up there,
it's mine and mine alone.

Mail sent to me from the newsgroups won't bounce but will
be ignored.  If I have time, I'll respond, but you  have
a better chance if you confine your posts to the newsgroups
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Technical Details
Message-ID: <34F5B829.93CC5610@corp.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6d233j$37c17@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,ff8748db1a68b7e0
X-Google-Attributes: gidf74b3,public
From: Rich Wilkman <rwilkman@corp.borland.com>
Subject: Re: Lack of enumerated types
Date: 1998/02/26
Message-ID: <34F5B829.93CC5610@corp.borland.com>
X-Deja-AN: 328903140
Content-Transfer-Encoding: 7bit
References: <6d233j$37c17@forums.borland.com>
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language