这样一段代码,为什么输出值为空?
class Book1 {
private String name;private double price;
public Book1(String name, double price) {
//name = this.name;
//price = this.price;
}
@Override
public String toString() {
return "书名:" + name + ",价格:" + price;
}
}
public class Test6 {
public static void main(String[] args) {
Book1 b = new Book1("JAVA教程的价格是:",98.5);
System.out.println(b);
}
}