我在a方法中调用下面的方法,如何在a方法中得到msg的信息
123456789101112//A类中使用B类方法public class A{ public static void main(String[] args){ B b = new B(); b.pint(); }}class B{ void pint(){ System.out.println("这是B类中的pint()方法。"); }}12345678910111213141516//B类中使用A类的方法public class B{ public static void main(String[] args){ A a = new A(); A.diaoyongB(); } //B类中的方法 void pint(){ System.out.println("B类中的pint()方法。"); }}class A{ void diaoyongB(){ new B().pint(); }}
热门标签: