質問編集履歴

2

toString()に関する記述ミス

2019/09/24 21:20

投稿

Swedon
Swedon

スコア67

test CHANGED
File without changes
test CHANGED
@@ -42,13 +42,11 @@
42
42
 
43
43
  のみでも、
44
44
 
45
- > Book{name='Atlas Shrugged', author=[Author{name='AynRand', email='aynrand@gamil.com', gender=f}, Author{name='JaneAustin', email='janeaustin@gmael.com', gender=f}, Author{name='KazuoIshiguro', email='kishigro@gmael.com', gender=m}], price=29.95, qty=0}
46
-
47
- Author's name is: [LAuthor;@2a139a55
48
-
49
-
50
-
51
- とAuthorにtoString()を実行したものと同じく出力されます
45
+ > Author's name is: [LAuthor;@2a139a55
46
+
47
+
48
+
49
+ と出力されます
52
50
 
53
51
 
54
52
 
@@ -94,11 +92,9 @@
94
92
 
95
93
  System.out.println(book1.toString());
96
94
 
95
+ System.out.println();
96
+
97
- System.out.println("Author's name is: " + book1.getAuthor().getName());
97
+ System.out.println("Author's name is: " + book1.getAuthor());
98
-
99
-
100
-
101
-
102
98
 
103
99
 
104
100
 

1

エラーメッセージのスクリーンショット画像の追加

2019/09/24 21:20

投稿

Swedon
Swedon

スコア67

test CHANGED
File without changes
test CHANGED
@@ -20,6 +20,8 @@
20
20
 
21
21
  その中で、TestBook.javaを実行するときに、book1.getAuthor().getName()で、「本のタイトル」ではなく、「作者の名前」を出力したいのですが、エラーが出てしまいます。
22
22
 
23
+ ![イメージ説明](1764df1418e104678b3800944d9f5b2b.png)
24
+
23
25
 
24
26
 
25
27
  試したこと