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

📄 movie.java

📁 绝对经典!好动西和大家一起分享 呵呵 你们不应该如此限制的,不好
💻 JAVA
字号:
/* Movie - Defines and manipulates a Movie object for MovieCat * Copyright (c) 2001, Bruce E. Wampler */import java.io.*;public class Movie    implements	Cloneable{    protected String title;    protected String director;    protected String year;    protected int genre;    protected int rating;    protected int format;    protected int evaluation;    protected String label;    protected String comments;    public void setTitle(String name) { title = name; }    public String getTitle() { return title; }    public void setDirector(String dir) { director = dir; }    public String getDirector() { return director; }    public void setYear(String yr) { year = yr; }    public String getYear() { return year; }    public void setGenre(int g) { genre = g; }    public int getGenre() { return genre; }    public void setRating(int r) { rating = r; }    public int getRating() { return rating; }    public void setFormat(int f) { format = f; }    public int getFormat() {return format;}    public void setEvaluation(int e) { evaluation = e; }    public int getEvaluation() { return evaluation; }    public void setLabel(String l) { label = l; }    public String getLabel() { return label; }    public void setComments(String c) { comments = c; }    public String getComments() { return comments; }    public Movie()    {	title = new String("");	director = new String("");	year = new String("");		genre = 0;	rating = 0;			format = 0;	label = new String("");		evaluation = 0;	comments = new String("");    }    // override Object.clone()    public Object clone()     {	Movie c = null;	try	{	    c = (Movie)super.clone();	       // copy ints	    c.title = new String(title);       // String doesn't	    c.director = new String(director); // have clone so	    c.label = new String(label);       // make copy of	    c.comments = new String(comments); // each String	}	catch (CloneNotSupportedException e)	{	    System.out.println(	            "Should never happen: Movie clone failed.");	}	return c;    }    public boolean readMovie(DataInputStream in)	throws IOException    {	try		// read one MovieCat record	{	    title = new String(in.readUTF());	    director = new String(in.readUTF());	    year = new String(in.readUTF());	    genre = in.readInt();	    rating = in.readInt();	    format = in.readInt();	    evaluation = in.readInt();	    label = new String(in.readUTF());	    comments = new String(in.readUTF());	    return true;	}	catch (EOFException e)	// all records read	{	    in.close();	    return false;	}          }    public void writeMovie(DataOutputStream out)        throws IOException    {	out.writeUTF(title);	out.writeUTF(director);	out.writeUTF(year);	out.writeInt(genre);	out.writeInt(rating);	out.writeInt(format);	out.writeInt(evaluation);	out.writeUTF(label);	out.writeUTF(comments);	    }    }

⌨️ 快捷键说明

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