Quote:
Originally Posted by byteit101
I was porting some code to Java (a new ZomB interface), and have come across only a few small snags:
1. How do you do enum's? I am getting "enums are not supported in source 1.3 use src 5 to enable" and my switch statement is not working either
2. What is the equivalent of the C++ GetClock() which returns seconds since boot. Currently i am using Timer.getUsClock() / 1000000f but it is kinda bulky
3. Can you turn off the error that classes need to be in their own files? I am hoping I can have a single file for a bunch of public classes
|
For #1, use (and repeat for each enum type
Code:
public static final <Insert Type Here> eVar1 = new <Insert Type Here>(ctor vars...){
<override/implement any methods here>
};
A simple String/Enum Constant would have to have 2 vars per 'enum', as Luke pointed out
Code:
public static final int sVar1 = 1;
public static final String sVar1_str = "Foo";
2.) I'd recommend using System.currentTimeMillis() (or System.nanoTime() if it's supported in 1.3) as soon as the main() method is called and storing it in a globally accessible variable.
3.) Everyone else has pretty much hit is spot on.