Make the isFiction method in BookFilter class static and replace LINE 10 with:
Code: Select all
.filter((Book b)->new BookFilter().isFiction(b)) //also works...
When I move the main() into a different class in the same package,
Code: Select all
.filter((Book b)->new BookFilter().isFiction(b)) //NOT COMPILE
Code: Select all
.filter((Book b)->Book.new BookFilter().isFiction(b)) //NOT COMPILE *** even if the main() is in Book
I know that when you have a nested static class, you cannot create it with instance of the outer class
but I don't understand why this wouldn't work?
any explanation for ***?