java 构造方法的私有——范例

2019年2月14日23:14:34 发表评论 941 views
/**
 * Created by xabcd on 2019/2/14.
 */
public class testprivate
{
    private testprivate(){
        System.out.println("private_test_private");
    }
    public static void main(String args[])
    {
        new testprivate();
    }
}




结果:
private_test_private

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: