Main.java revision f6c387128427e121477c1b32ad35cdcaa5101ba3
1// Copyright 2008 The Android Open Source Project
2
3import java.lang.reflect.Field;
4
5/**
6 * Try some stuff with enumerations.
7 */
8public class Main {
9    public enum Shubbery { GROUND, CRAWLING, HANGING }
10
11    public static void main(String[] args) {
12        Field field;
13        try {
14            field = Shubbery.class.getDeclaredField("CRAWLING");
15        } catch (NoSuchFieldException nsfe) {
16            throw new RuntimeException(nsfe);
17        }
18
19        System.out.println("found field " + field.getName());
20        System.out.println("  synthetic? " + field.isSynthetic());
21        System.out.println("  enum? " + field.isEnumConstant());
22    }
23}
24
25