public class Film {
public String type;//类型
public String name;//名称
public String director;//导演
public String actor;//主演
public Film(){
}
public Film(String type){
this.type=type;
}
public Film(String type,String name,String director,String actor){
this.type=type;
this.name=name;
this.director=director;
this.actor=actor;
}
//影片简介行为要返回一个字符串所以要string返回类型
public String display(){
String msq="影片类型:"+type+"\n片名:"+name+"\n导演:"+director+"\n主演:"+actor;
return msq;
}
}
public class FilmTest {
/**
* @param args
*/
public static void main(String[] args) {
Film f=new Film();
f.type="奇幻";
f.name="大约在雨季";
f.director="平冈";
f.actor="土井裕泰";
System.out.println(f.display());
System.out.println("****************************");
Film f2=new Film("爱情片","不能说的秘密","周杰伦","周杰伦、桂纶镁");
String msq=f2.display();
System.out.println(msq);
}
}
public String type;//类型
public String name;//名称
public String director;//导演
public String actor;//主演
public Film(){
}
public Film(String type){
this.type=type;
}
public Film(String type,String name,String director,String actor){
this.type=type;
this.name=name;
this.director=director;
this.actor=actor;
}
//影片简介行为要返回一个字符串所以要string返回类型
public String display(){
String msq="影片类型:"+type+"\n片名:"+name+"\n导演:"+director+"\n主演:"+actor;
return msq;
}
}
public class FilmTest {
/**
* @param args
*/
public static void main(String[] args) {
Film f=new Film();
f.type="奇幻";
f.name="大约在雨季";
f.director="平冈";
f.actor="土井裕泰";
System.out.println(f.display());
System.out.println("****************************");
Film f2=new Film("爱情片","不能说的秘密","周杰伦","周杰伦、桂纶镁");
String msq=f2.display();
System.out.println(msq);
}
}