001package singleton.pub4;
002public abstract class S {
003        private static S instance;
004        static {
005                if ("linux".equals(System.getProperty("os.name")))
006                        instance = new SLinux();
007                else
008                        instance = new SOther();
009        }
010        public static S get() {return instance;}
011        public abstract int inc();
012}
013final class SLinux extends S {
014        private int i;
015        public int inc() {return ++i;}
016}
017final class SOther extends S {
018        private int i;
019        public int inc() {return --i;}
020}