⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 student.java

📁 java源程序 对初学者有很大的帮助 从简单到复杂
💻 JAVA
字号:
//********************************************************************
//  Student.java       Author: Lewis/Loftus
//
//  Represents a student. Used to demonstrate inheritance.
//********************************************************************

public class Student
{
   protected String name;
   protected int numCourses;

   //-----------------------------------------------------------------
   //  Sets up a student with the specified name and number of
   //  courses.
   //-----------------------------------------------------------------
   public Student (String studentName, int courses)
   {
      name = studentName;
      numCourses = courses;
   }

   //-----------------------------------------------------------------
   //  Returns information about this student as a string.
   //-----------------------------------------------------------------
   public String toString()
   {
      String result = "Student name: " + name + "\n";

      result += "Number of courses: " + numCourses;

      return result;
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -