Skip to content

Commit bf7f4b3

Browse files
saikatcse03ine12363914
andauthored
Added code to demo expected package error (eugenp#11045)
* Added code for demo package error * Corrected the package declaration * BAEL-4216 Corrected Formatting and Removed final and Super * Added few comments as per PR * Update Book.java Formatted comments with spaces Co-authored-by: ine12363914 <[email protected]>
1 parent e505326 commit bf7f4b3

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// The next line is commented out to avoid the code to fail the build.
2+
// package com.baeldung;
3+
4+
/**
5+
* If the below package declaration is commented out and the above incorrect package
6+
* declaration is uncommented, then the problem will replicate.
7+
*/
8+
package com.baeldung.bookstore;
9+
10+
public class Book {
11+
12+
private String title;
13+
private String author;
14+
private long isbn;
15+
16+
public Book(String title, String author, long isbn) {
17+
this.title = title;
18+
this.author = author;
19+
this.isbn = isbn;
20+
}
21+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.baeldung.bookstore;
2+
3+
import java.util.Random;
4+
5+
public class LibraryAdmin {
6+
7+
public Book createBook(String title, String author) {
8+
9+
final long isbn = new Random().nextLong();
10+
11+
return new Book(title, author, isbn);
12+
}
13+
14+
}

0 commit comments

Comments
 (0)