• 2021-04-14
    以下代码的输出结果?public class Test{public sta...tring m){m=m+2;}}
  • hello

    内容

    • 0

      给出下列代码,如何使成员变量m 被方法fun()直接访问? class Test { private int m; public static void fun() { } }

    • 1

      给出下列程序的输出结果。import java.io.IOException;public class E {public static void main(String args[]){int m =10;try {methodA();m = 100;}catch(IOException e){m = 1000;}System.out.println(m);}public static void methodA() throws IOException{throw new IOException();}}

    • 2

      尝试运行下面的代码会发生什么?( )public class Test { public static void main(String[] args) { boolean m = true; if (m = false) { System.out.println("true"); } else { System.out.println("false"); } }} A: 输出字符串”true” B: 输出字符串”false” C: 编译时错误 D: 运行时错误

    • 3

      给出下列代码,如何使成员变量m被方法fun()直接访问?class Test { private int m; public static void fun( ) { ... }} A.将 private int m 改为protected int m B.将private int m 改为public int m C.将private int m改为static int m D.将private int m改为int m

    • 4

      给出如下代码: class Test{ private int m(){ ...... } public static void fun() { ...... } } 如何使成员函数m() 被函数fun()直接访问 A: 将private int m() 改为protected int m() B: 将private int m() 改为 public int m() C: 将private int m() 改为 static int m() D: 将private int m() 改为 int m()