ArrayList ar = new ArrayList();
for(String item : ar) {
...
}
####
ArrayList ar = new ArrayList();
for(Iterator i = ar.iterator(); ar.hasNtext(); ) {
String item = (String) i.next();
}
####
my @ar ;
foreach my $item (@ar) {
...
}
####
public enum int {MENU_FILE, MENU_EDIT, MENU_FORMAT, MENU_VIEW} ;
####
public int MENU_FILE = 0;
public int MENU_EDIT = 1;
public int MENU_FORMAT = 2;
public int MENU_VIEW = 3;
####
my ($MENU_FILE, $MENU_EDIT, $MENU_FORMAT, $MENU_VIEW) = (0..4) ;
####
------------------------------------------
package com.name;
interface XYZ {
public static final double Constant1 = someValue;
public static final double Constant2 = anotherValue;
}
------------------------------------------
import static com.name.XYZ.*;
public class MyClass {
...
double value = 2 * Constant1;
...
}
####
use XYZ qw(Constant1) ;
use XYZ qw(:SOMEGROUP) ;