-2
(對於我的記錄,我仍然是編程新手)因此,對於我的CS類中的一個,我們有這個項目,其中的一部分是不得不打印出課程的屬性,而且我很難做到這一點?真的很感激幫助我敢肯定它可能是簡單的,但我一直都用它掙扎了一會兒如何從一個類打印屬性?
public class Product {
private int ProductId;
private String Description;
private double Price;
public Product(int pID, String description, double price) {
ProductId = pID;
Description = description;
Price = price;
}
public int getProductID() {
return this.ProductId;
}
public void setProductID(int input) {
this.ProductId = input;
}
public String getDescription() {
return this.Description;
}
public void setDescription(String DescriptionInput) {
this.Description = DescriptionInput;
}
public double getPrice() {
return this.Price;
}
public void setPrice(double priceInput) {
this.Price = priceInput;
}
}
到目前爲止你有什麼嘗試? –
嘗試搜索之前張貼!這個問題以前肯定有人問過。 –
在Java API中查看'System.out.println()' – Lopan