以下代码运行输出是()class Man {private String n...println(m.name);}}
举一反三
- 以下代码运行输出是()classMan{ privateStringname=Jack; intage=30;}publicclassManTest{ publicStringtel; publicstaticvoidmain(String[]args){ Manm=newMan(); System.out.println(m.name); }}
- 在以下代码中,( )是类Teacher的方法。 public class Teacher { int age=33; private string name; public string Name { get{return name;} set{name=value;} } public void SaySomething(){ //….. } }
- 4.6 若有以下程序代码: class Person{ String name,department; int age; public Person(String n){name=n;} public Person(String n, int a){name=n; age=a;} public Person(String n, String d, int a ){ //执行此代码 } 下面那个选项可以添加到“//执行此代码”前面( )
- 下列程序的运行结果是( )class Demo{private String name;Demo(String name){this.name = name;}private static void show(){System.out.println(name)}public static void main(String[] args){Demo d = new Demo(“lisa”);d.show();}}
- 请填写代码 public class Teacher { int age=33; private string name; public string Name { get{请在此处填上代码} set{请在此处填上代码} } } public void SaySomething{ //….. }