package com.xunpoit.www; public class PrivateTest { private void method1(){ System.out.println("这是私有修饰符"); } void method2(){ System.out.println("这是默认修饰符"); } protected void method3(){ System.out.println("这是保护修饰符"); } public void method4(){ System.out.println("这是公共修饰符"); } public static void main(String[] args){ PrivateTest st=new PrivateTest(); st.method1(); st.method2(); st.method3(); st.method4(); } };