实现单例模式,并实现方法int getResult(float a),将a*8后返回。
package jinshanwangluo.exam; /** * @author guoxm * @date 2014-12-15 */ public class SingleTon { private SingleTon() { } private static SingleTon singleTon = null; static { singleTon = new SingleTon(); } public static SingleTon getSingleTon() { return singleTon; } public int getResult(float num) { return (int) num * 8; } }