book.java
来自「国外的数据结构与算法分析用书」· Java 代码 · 共 24 行
JAVA
24 行
/** A class representing a book. It has instance variables
title, author, and isbn number, and a toString method. */
public class Book
{
/** Attributes of a book */
protected String title, author, isbn;
/** Create a new book
Analysis: Time = O(1) */
public Book(String t, String a, String i)
{
title = new String(t);
author = new String(a);
isbn = new String(i);
}
/** A string representation of the book.
Analysis: Time = O(1) */
public String toString()
{
return "\n Title: " + title + ", Author: " + author + ", Isbn: " + isbn + "\n";
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?