首页上一页 1 下一页尾页 1 条记录 1/1页
java入门到精通例子7.12
发表在Java图书答疑
2009-06-26
是否精华
是
否
版块置顶:
是
否
你好 我根据书java从入门到精通上输入的例子7.1 有些问题困扰 请指教
我用的Eclipse3.4.2
以下是代码:
public class Book {
private int id;
private String name;
private String category;
public String getName (){
int id = 0;
setName("java");
return id + this.name;
}
private void setName(String name){
this.name = name;
}
public Book book(){
return this;
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stu
}
}
警告信息:the field book.category is never read locally
the field book.id is never read locally
是否Book类中的属性 id,catagory没封装?请说明谢谢
我用的Eclipse3.4.2
以下是代码:
public class Book {
private int id;
private String name;
private String category;
public String getName (){
int id = 0;
setName("java");
return id + this.name;
}
private void setName(String name){
this.name = name;
}
public Book book(){
return this;
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stu
}
}
警告信息:the field book.category is never read locally
the field book.id is never read locally
是否Book类中的属性 id,catagory没封装?请说明谢谢