gameentry-gameentry.html

来自「经典的数据结构源代码(java 实现)」· HTML 代码 · 共 30 行

HTML
30
字号
<html><head><title>Code Fragment</title></head><body text=#000000><center></center><br><br><dl><dd><pre>  <font color=#8000a0><font color=#8000a0>public</font> </font><font color=#ff8000>class</font> GameEntry {    <font color=#8000a0><font color=#8000a0>protected</font> </font><font color=#8000a0>String</font> name;	<font color=#ff0080>// name of the person earning this score</font>    <font color=#8000a0><font color=#8000a0>protected</font> </font><font color=#8000a0>int</font> score;	<font color=#ff0080>// the score value</font>    <font color = #ff0080>/** Constructor to create a game entry */</font>    <font color=#8000a0><font color=#8000a0>public</font> </font><font color=#0000ff>GameEntry</font>(<font color=#8000a0>String</font> n, <font color=#8000a0><font color=#8000a0>int</font> </font>s) {      name = n;      score = s;    }    <font color = #ff0080>/** Retrieves the name field */</font>    <font color=#8000a0><font color=#8000a0>public</font> </font><font color=#8000a0>String</font> <font color=#0000ff>getName</font>() { <font color=#8000a0><font color=#ff8000>return</font> </font>name; }    <font color = #ff0080>/** Retrieves the score field */</font>    <font color=#8000a0><font color=#8000a0>public</font> </font><font color=#8000a0>int</font> <font color=#0000ff>getScore</font>() { <font color=#8000a0><font color=#ff8000>return</font> </font>score; }    <font color = #ff0080>/** Returns a string representation of this entry */</font>    <font color=#8000a0><font color=#8000a0>public</font> </font><font color=#8000a0>String</font> <font color=#0000ff>toString</font>() {       <font color=#ff8000>return</font> <font color=#008000>"("</font> + name + <font color=#008000>", "</font> + score + <font color=#008000>")"</font>;     }  }</dl></body></html>

⌨️ 快捷键说明

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