Вроде программу гонял - всё добавляется, причём с новой строки. Может кто подскажет, что не так?
package com.javarush.task.task18.task1827;
public class Product {
private int id;
private String productName;
private double price;
private int quantity;
public Product(String[] parametrs) {
StringBuilder Name = new StringBuilder(30);
for (int i = 1; i < parametrs.length - 2; i++) {
Name.append(parametrs[i]).append(" ");
}
this.productName = Name.toString().trim();
this.price = Double.parseDouble(parametrs[parametrs.length - 2]);
this.quantity = Integer.parseInt(parametrs[parametrs.length - 1]);
}
public int getId() {
return id;
}
public String getProductName() {
return productName;
}
public double getPrice() {
return price;
}
public int getQuantity() {
return quantity;
}
public void setId(int id) {
this.id = id;
}
public void setProductName(String productName) {
this.productName = productName;
}
public void setPrice(double price) {
this.price = price;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
}