题目内容

静态方法中不能直接调用非静态方法。

A. 对
B. 错

查看答案
更多问题

读程序,写出和程序输出格式一致的输出结果。public class J_Test {void mb_method() {System.out.println("J_Test::mb_method");}void mb_methodStatic() {System.out.println("J_Test::mb_methodStatic");}public static void main(String[] args) {J_Test a = new J_Test();a.mb_method();a.mb_methodStatic();J_Test b = new J_Test();b.mb_method();b.mb_methodStatic();}}

读程序,写出和程序输出格式一致的输出结果。class ValHold {public int i = 10;}public class ObParm {public static void main(String[] args) {ObParm o = new ObParm();o.amethod();}public void amethod() {int i = 99;ValHold v = new ValHold();v.i = 30;another(v, i);System.out.println(v.i + " " + i);}public void another(ValHold v, int i) {i = 0;v.i = 20;ValHold vh = new ValHold();v = vh;System.out.println(v.i + " " + i);}}

读程序,写出输出结果。class Demo{public void test() {System.out.println("NO");}public void test(int i) {System.out.println(i);}public void test(int a,int b) {System.out.println(a+b);}}public class Test {public static void main(String[] args) {Demo de=new Demo();de.test();de.test(5);de.test(6,8);}}

读程序,写出和程序输出格式一致的输出结果。public class J_Test {public static void mb_method(int i) {if(i == 1){System.out.print("1");}else{System.out.print("4");}}public static void main(String[] args) {mb_method(0);mb_method(1);}}

答案查题题库