slogan.java

来自「Java 程序设计教程(第五版)EXAMPLESchap06源码」· Java 代码 · 共 39 行

JAVA
39
字号
//********************************************************************//  Slogan.java       Author: Lewis/Loftus////  Represents a single slogan string.//********************************************************************public class Slogan{   private String phrase;   private static int count = 0;   //-----------------------------------------------------------------   //  Constructor: Sets up the slogan and counts the number of   //  instances created.   //-----------------------------------------------------------------   public Slogan (String str)   {      phrase = str;      count++;   }   //-----------------------------------------------------------------   //  Returns this slogan as a string.   //-----------------------------------------------------------------   public String toString()   {      return phrase;   }   //-----------------------------------------------------------------   //  Returns the number of instances of this class that have been   //  created.   //-----------------------------------------------------------------   public static int getCount ()   {      return count;   }}

⌨️ 快捷键说明

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