public static void main(String[] args) {
// create a book named "Java is Fun" with 200 in stock costing 55.00 each. The stock number is 1234
Book javafun = new Book("Java is Fun", 200, 55.00, 1234);
//print out the book using the toString() method
System.out.println (javafun.toString());
//create a book calling the empty constructor.
Book newbook2 = new Book();
//set the title to "Databases R Us"
String title = "Databases R Us";
//set the number in stock to 50
int numInStock = 50;
// set the cost each to $35.00
double cost = 35.00; <------ this
// set the stock number to 5555
int stockNum = 5555;
//print out the book.
System.out.println(newbook2.toString());
//change the price to $55.00
double cost = 55.00; <-- and this gives me duplicate error
//print out the book
System.out.println (newbook2.toString());
}
어떻게 공간 아래의 단계를 수행 할 수 있습니까?java get missing missing field
나는 그것이해야한다고 생각하는 것을 만들었지 만 그것은 나에게 중복을 주었다. 출력 잘
출력해야 나오는되지 않습니다
자바 ID 번호 1234 재미있는 것은 $ 55.00 각 원가 계산 주식에 200 권의 책을 가지고있다.
ID 번호가 5555 인 데이터베이스에는 50 권의 책이 있으며, 가격은 $ 35.00입니다.
데이터베이스 R ID 번호가 5555 인 회사에는 50 권의 책이 있으며, 책은 $ 55.00입니다.
변화 가격은 단지 필요로'비용 = 55.00; '(앞의'double'없이). 다른 "출력이 올바르지 않다"는 경우,'Book'의 코드가 필요합니다. 예상되는 결과는 무엇입니까? – tofi9
우리가 수업 도서를 제공 할 수 있다면 u를 도울 수 있습니다. : D 감사합니다 ... –
내 주요 응용 프로그램에서 [setter 메서드 호출] 가능한 복제본 (http://stackoverflow.com/questions/4603353/calling-setter-methods-in-my-main-application) – Joe