General Joined: 3/8/2016(UTC) Posts: 1,156 Thanks: 312 times Was thanked: 185 time(s) in 149 post(s)
|
Are Enum Are HardCoded
- What are these enum , what certain things that they can do? |
|
|
|
|
General Joined: 12/30/2011(UTC) Posts: 982
Thanks: 95 times Was thanked: 574 time(s) in 364 post(s)
|
Yip, enums(enumerations) are hardcoded... It is something like this, I will do it in java code: Code:
public enum Superweapons {
NUCLEAR_MISSILE(Radioactivity),
ANTHRAX_BOMB(Biohazard),
FUEL_BOMB(Firestorm);
private String damage;
Superweapons(String damage) {
this.damage = damage;
}
public String getDamage() { // :P
return damage;
}
}
public class SWDemo {
public static void main(String args(square brackets here)) {
// Display damage of nuclear missile superweapon, prints ´Radioactivity´
System.out.println(Superweapons.NUCLEAR_MISSILE.getDamage());
// Display all sw´s and damages.
System.out.println("All Superweapon damages:");
for (Superweapons sw : Superweapons.values())
System.out.println(sw + " gives " + sw.getDamage() + " damage.");
}
}
You can tie certain characteristics to an enum such as a texture for example, usually enums and other final parameters are capitalized, e.g. NUCLEAR_MISSILE. Cheers Edited by user Friday, November 10, 2017 12:10:15 PM(UTC)
| Reason: Secret |
Panem et kirkinses |
1 user thanked acidbrain for this useful post.
|
|
|
General Joined: 3/8/2016(UTC) Posts: 1,156 Thanks: 312 times Was thanked: 185 time(s) in 149 post(s)
|
can we make our own enum and use it to generals? you think? |
|
|
|
|
General Joined: 12/30/2011(UTC) Posts: 982
Thanks: 95 times Was thanked: 574 time(s) in 364 post(s)
|
|
Panem et kirkinses |
|
|
|
Users browsing this topic |
Guest
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.