单选题类Student的声明如下:   package com.school class Student{ String name;  int age;  Student(String name,int age){  //code } void study(String subject){ / /code } }  正确调用方法study(String subject)的是哪项?()A Student stu = new Student(“Tom”,23); stu.study(“数学”);B Stude

题目
单选题
类Student的声明如下:   package com.school class Student{ String name;  int age;  Student(String name,int age){  //code } void study(String subject){ / /code } }  正确调用方法study(String subject)的是哪项?()
A

Student stu = new Student(“Tom”,23); stu.study(“数学”);

B

Student.study(“数学”);

C

Student stu = new Student(“Tom”,23); stu.study();

D

Student stu = new Student(“Tom”,23); String result=stu.study(“数学”);


相似考题

1.阅读以下说明和java代码,将应填入(n)处的字句写在对应栏内。[说明]有若干教师,每个教师只有姓名,一个教师可以指导多名研究生;每名研究生有姓名和研究方向,程序最后输出每个教师指导的所有研究生的姓名和研究方向。[Java程序]public class Teacher {String name;int top=0;Student[] student=new Student[20];public Teacher() {}public Teacher(String name) { this.name=name;}boolean add(Student stu){int len=this.student.length;if (top<len-1) {this.student[top]=siu;(1);return true;}elsereturn (2);}void disp(){System.out.println(“指导老师"”+this.name);System.out.println(“研究生:”);for(int i=0;i<(3);i++){System.out.println(“姓名:”+this.student[i].name+“\t研究方向:”+this.student[i]. search);}}public static void main(String[] args){Teacher t[]={new Teacher(“李明”),new Teacher(“王华”)};Student s1 = new Student(“孙强”,“数据库”);Student s2 = new Student(“陈文”,“软件工程”);Student s3 = new Student(“章锐”,“计算机网络”);if(! t[0].add(s1)) {System.out.println(“每个老师最多只能指导20个学生!”);}if(! t[0].add(a2)) {System.out.println(“每个老师最多只能指导20个学生!”);}if(! t[1].add(s3)) {System.out.println(“每个老师最多只能指导20个学生!”);}for(int i=0;i<2;i++)(4);}}class (5) {String name;String search;public Student(){}public Student(String name,String search){this.name=name;this.search=search;}String getName(){return this.name;}String getSearch(){return this.search;}}

更多“单选题类Student的声明如下:   package com.school class Student{ String name;  int age;  Student(String name,int age){  //code } void study(String subject){ / /code } }  正确调用方法study(String subject)的是哪项?()A Student stu = new Student(“Tom”,23); stu.study(“数学”);B Stude”相关问题
  • 第1题:

    设有如下的记录类型: TypeStudent number As String name AS String age As Integer End Type 则正确引用该记录类型变量的代码是( )。

    A.Student.name="张红"

    B.Dim s As Student s.name="张红"

    C.Dim s As Type Student s.name="张红"

    D.Dim s As Type s.name="张红"


    正确答案:B

  • 第2题:

    设有如下的记录类型: Type Student Number As String Name As String Age As Integer End Sub 则能正确引用该记录类型变量的代码是( )。

    A.Student.name=""

    B.Dim s As Students.name=“张红”

    C.Dims As Tye Students.name=“张红”

    D.DimsAsTypes.name=“张红”


    正确答案:B

  • 第3题:

    阅读以下说明和Java 码,将应填入(n)处的字名写在的对应栏内。

    [说明] 编写一个学生类Student,要求:

    (1) 学生类Student 属性有:

    id: long 型,代表学号

    name: String类对象,代表姓名

    age: int 型,代表年龄

    sex: boolen 型,代表性别(其中:true 表示男,false 表示女)

    phone: String 类对象,代表联系电话

    (2) 学生类Student 的方法有:

    Student (long i,String n,int a,boolean s,String p)

    :有参构造函数,形参表中的参数分别初始化学号、姓名、

    年龄、性别和联系电话。

    int getAge ():获取年龄作为方法的返回值。

    boolean getSex ():获取性别作为方法的返回值。

    String getPhone ():获取联系电话作为方法的返回值。

    public String to String ():以姓名:性别:学号:联系电话的形式作为方法的返

    import java. applet. Applet;

    import java. awt.* ;

    public class Student extends Applet {

    long id;

    String name, phone;

    int age;

    boolean sex;

    Student(long i, String n, int a, boolean s, String p)

    {

    id=i;

    name = n;

    age = a;

    sex= s;

    phone = p;

    {

    public void paint( Graphics g)

    {

    Student x= new Student (5000," xiaoliu" , 89, true, " 8989898" );

    (1);

    (2)

    g. drawstring( x. getPhone( ), 140,140);

    }

    int getAge( )

    { return age; }

    boolean getsex ( )

    { return sex; }

    String getPhone( )

    { return phone; }

    String ToString( )

    {

    (3)

    }

    }


    正确答案:g. drawString(x. ToString( ) 20100) g. drawString(x getAge( ) 80120); retum(“姓名”+name + “学号:” + id + “联系电话:”" +phone) ;
    g. drawString(x. ToString( ) ,20,100) g. drawString(x, getAge( ) ,80,120); retum(“姓名”+name + “学号:” + id + “联系电话:”" +phone) ;

  • 第4题:

    设有如下的记录类型: Type Student number As String name As String age As Integer End Type 则正确引用该记录类型变量的代码是______。

    A.StUdent.name=""

    B.Dim s As StUdent s.name="张红"

    C.Dim s As Type Student s.name="张红"

    D.Dim s As Type s.name="张红"


    正确答案:B

  • 第5题:

    执行以下代码后,下面哪些描述是正确的() public  class  Student{  private String name = “Jema”;  public void setName(String name){  this.name = name;  }  public String getName(){  return this.name;  }  public static void main(String[] args){  Student s;  System.out.println(s.getName()); } }

    • A、输出null
    • B、第10行编译报错
    • C、第11行编译报错
    • D、输出Jema

    正确答案:C

  • 第6题:

    类Student的声明如下:   package com.school class Student{ String name;  int age;  Student(String name,int age){  //code } void study(String subject){ / /code } }  正确调用方法study(String subject)的是哪项?() 

    • A、Student stu = new Student(“Tom”,23); stu.study(“数学”);
    • B、Student.study(“数学”);
    • C、Student stu = new Student(“Tom”,23); stu.study();
    • D、Student stu = new Student(“Tom”,23); String result=stu.study(“数学”);

    正确答案:A

  • 第7题:

    类 Student 中字段mark的缺省值是哪项?()   Class Student{   String name;   int age;   float market;   ·········   }  

    • A、0.0f
    • B、numll
    • C、false
    • D、0
    • E、0.0

    正确答案:A

  • 第8题:

    对于如下代码,描述正确的是哪项? ()   class Student{   public static void main(String[] args){   Student student = new Student();  }  }  

    • A、Student student 声明了一个类
    • B、new Student()创建了Student 对象的一个实例
    • C、Student student 声明了对象Student 的一个引用
    • D、class Student 声明了一个类

    正确答案:A,B,D

  • 第9题:

    多选题
    对于如下代码,描述正确的是哪项?()  class Student{   public static void main(String[] args){   Student student=new Student();  }  }
    A

    new Student()创建了Student对象的一个实例

    B

    Student student声明了对象Student的一个引用

    C

    class Student声明了一个类

    D

    new Student()创建了一个类

    E

    Student student 声明了一个类


    正确答案: D,C
    解析: 暂无解析

  • 第10题:

    多选题
    对于如下代码,描述正确的是哪项? ()   class Student{   public static void main(String[] args){   Student student = new Student();  }  }
    A

    Student student 声明了一个类

    B

    new Student()创建了Student 对象的一个实例

    C

    Student student 声明了对象Student 的一个引用

    D

    class Student 声明了一个类


    正确答案: A,C
    解析: 暂无解析

  • 第11题:

    单选题
    类 Student 中字段mark的缺省值是哪项?()   Class Student{   String name;   int age;   float market;   ·········   }
    A

    0.0f

    B

    numll

    C

    false

    D

    0

    E

    0.0


    正确答案: B
    解析: 暂无解析

  • 第12题:

    单选题
    有下列语句:  struct Birthday{public int year;  public int month;   public int day;}; struct Student{ int no;  string name;   int age;  public Birthday bir; };  ……  Student Stu;  如果要把Stu的出生年份赋值为1988,正确的语句是()
    A

     Stu.bir.year=1988;

    B

     Stu.year=1988;

    C

     Stu. Birthday.year=1988;

    D

     Student. Birthday.year=1988;


    正确答案: D
    解析: 暂无解析

  • 第13题:

    根据下面的程序,可以在主程序中使用的合法语句是( )。 include using namesp

    根据下面的程序,可以在主程序中使用的合法语句是( )。 #include <iostream> using namespace std; class Person{ int age; public: void SetAge(int x){age=x;} void ShowAge(){cout<<"the Person's age is" <<age;} }; class Student:private Person{ public:int study_code; }; void main(){ Student wangqiang; wangqiang.study_code=23; }

    A.wangqiang.age=231

    B.wangqiang.Setage(23)

    C.wangqiang.ShowAge()

    D.wangqiang.study_code=12


    正确答案:D
    解析:由于是私有继承,基类中所有成员成为派生类中的私有成员,故不能由派生类的对象访问,只有派生类的公有成员可由派生类对象访问。

  • 第14题:

    有如下语句: Type Student Name As String Age As Integer Sex As String End Type Dim Stu As Student With Stu .Name="张红" .Age=22 .Sex="女" End With 执行Print Stu.Age语句后的结果是

    A.张红

    B.22

    C.“女”

    D.Age


    正确答案:B
    解析:本题重点需理解自定义类型Student以及Student类型的变量Stu的使用。在使用Stu变量时用到了With...End With的结构,在该结构中的语句.Age=22相当于语句Stu. Age=22。故最后执行Print Stu. Age语句的结果值应为22。

  • 第15题:

    要求:

    1. 按如下类图写出相应数据库建表 sql 脚本。 其中 Student 和 Score 是1 对多的关系,Scroe 和 Course

    是多对 1 的关系。

    Student

    -id: String

    -name: String

    -birthday: Date

    -address: String

    -phone: String

    -email: String

    Score

    -student: Student

    -course: Course

    -grade: float

    Course

    -id: String

    -name: String

    -description: String


    正确答案:
     

  • 第16题:

    有下列语句:  struct Birthday{public int year;  public int month;   public int day;}; struct Student{ int no;  string name;   int age;  public Birthday bir; };  ……  Student Stu;  如果要把Stu的出生年份赋值为1988,正确的语句是()

    • A、 Stu.bir.year=1988;
    • B、 Stu.year=1988;
    • C、 Stu. Birthday.year=1988;
    • D、 Student. Birthday.year=1988;

    正确答案:A

  • 第17题:

    类Student代码如下:  class Student{    String name;  int age;  Student(String nm){  name = nm; } }  执行语句Student stu = new Student()后,字段age的值是哪项?() 

    • A、 0
    • B、 null
    • C、 false
    • D、 编译错误

    正确答案:D

  • 第18题:

    下列有关类声明的代码片段,哪一项是正确的?() 

    • A、 import java.sql.*; package school; class Student{ }
    • B、 package school; import java.sql.*; class Student{ }
    • C、 package school; class Student{ } import java.sql.*;
    • D、 package school; import java.sql.*;private String name; class Student{ }

    正确答案:B

  • 第19题:

    对于如下代码,描述正确的是哪项?()  class Student{   public static void main(String[] args){   Student student=new Student();  }  }  

    • A、new Student()创建了Student对象的一个实例
    • B、Student student声明了对象Student的一个引用
    • C、class Student声明了一个类
    • D、new Student()创建了一个类
    • E、Student student 声明了一个类

    正确答案:A,B,C

  • 第20题:

    类Student代码如下:D   class Student{   String name;   int age;   Student(String nm){ (构造方法)   name = nm;  }  }   执行语句Student stu = new Student()后,字段age的值是哪项?()

    • A、 0
    • B、 null
    • C、 false
    • D、 编译错误

    正确答案:D

  • 第21题:

    单选题
    类Student代码如下:  class Student{    String name;  int age;  Student(String nm){  name = nm; } }  执行语句Student stu = new Student()后,字段age的值是哪项?()
    A

     0

    B

     null

    C

     false

    D

     编译错误


    正确答案: D
    解析: 暂无解析

  • 第22题:

    单选题
    下列有关类声明的代码片段,哪一项是正确的?()
    A

     import java.sql.*; package school; class Student{ }

    B

     package school; import java.sql.*; class Student{ }

    C

     package school; class Student{ } import java.sql.*;

    D

     package school; import java.sql.*;private String name; class Student{ }


    正确答案: A
    解析: 暂无解析

  • 第23题:

    单选题
    类Student代码如下:D   class Student{   String name;   int age;   Student(String nm){ (构造方法)   name = nm;  }  }   执行语句Student stu = new Student()后,字段age的值是哪项?()
    A

     0

    B

     null

    C

     false

    D

     编译错误


    正确答案: C
    解析: 暂无解析

  • 第24题:

    单选题
    类Student的声明如下:   package com.school class Student{ String name;  int age;  Student(String name,int age){  //code } void study(String subject){ / /code } }  正确调用方法study(String subject)的是哪项?()
    A

    Student stu = new Student(“Tom”,23); stu.study(“数学”);

    B

    Student.study(“数学”);

    C

    Student stu = new Student(“Tom”,23); stu.study();

    D

    Student stu = new Student(“Tom”,23); String result=stu.study(“数学”);


    正确答案: D
    解析: 暂无解析