在JAVA中静态方法中只能调用其他,静态方法.main方法都是静态方法,如果想调用其它的方法,要么只能是其它的静态方法.还有一种方法就是将当前类实例化在调用它的非静态方法 public class text1{ public static void main(String [] args){ int a = 12; int b = 23; text1 aa = new text1(); aa.add(a,b); } public void add(int a,int b){ System.out…
内部类访问外部类的变量必须是final吗? 如下: package com.java.concurrent; class A { int i = 3; public void shout() { class B { public void shout1() { System.out.println(i); } } B b = new B(); b.shout1(); } public static void main(String[] args) { A a = new A(); a.shout…