Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 202
  • Last Modified:

enumish

Is there a way to get values (final statics) assigned without the work - like a c enum thing?

work
interface IFace {
  int a = 1;
  int b = 2;
  int c = 3;
}

no work (no work)
interface IFace {
  int a = 1;
  int b;
  int c;
}
0
hank1
Asked:
hank1
1 Solution
 
mjenkinsCommented:
IF you just want an "enum" type and are not specifically concerned with the values, you can:

public final class Enum
{
      public static final Enum A = new Enum();
      public static final Enum B = new Enum();      
      public static final Enum C = new Enum();      
      public static final Enum D = new Enum();
}


0
 
hank1Author Commented:
Wanted ints but understand Java cannot do this.  Thanks.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now