LazLondon (13) [Avatar] Offline
#1
Option C: 'Removing the definition of class Car will compile the code.'

So the class 'definition' includes everything about the Car class, including its declaration? I am just a bit confused about the border of declaration and definition. I thought the definition is what we can see within curly braces.

----------------------------------------------------------------------------------------------------------

Option E: 'Changing class Multiple2 to a a non-public class will compile the code.'

There is no class Multiple2 in this example but interface.

------------------------------------------------------------------------------------------

Kind Regards,
Laz
LazLondon (13) [Avatar] Offline
#2
Re: Twist in the Tale 1.2 ERROR
According to Oracle http://docs.oracle.com/javase/tutorial/java/javaOO/classdecl.html

and stackoverflow.com: http://stackoverflow.com/questions/11715485/what-is-the-difference-between-declaration-and-definition-in-java

'The conceptual difference:

Declaration: You are declaring that something exists, such as a class, function or variable. You don't say anything about what that class or function looks like, you just say that it exists.

Definition: You define how something is implemented, such as a class, function or variable, i.e. you say what it actually is.

In Java, there is little difference between the two, and formally speaking, a declaration includes not only the identifier, but also it's definition.

Java doesn't really separate declarations and definitions. You define them at the point where you declare them.'

So at the end of the day, Option C is well written smilie
mala.gupta (245) [Avatar] Offline
#3
Re: Twist in the Tale 1.2 ERROR
Laz,

Thanks for your posts.

I'm pleased to notice that you checked about the differences-'definition' vs. 'declaration', with Java's tutorial at Oracle and with forums at StatckOverFlow.com. I am sure your inquisitive mind would help you scale great heights in your career.

>>>
Option E: 'Changing class Multiple2 to a non-public class will compile the code.'
There is no class Multiple2 in this example but interface.
>>>

Thanks for reporting it to me. I've added it to the errata.

With respect,
Mala
527841 (1) [Avatar] Offline
#4
There are errors in twist in the tale 1.1 and 1.2.

Declaring a public interface or a public class inside another class with another name does not throw an error in Java 8.

Can you please check and correct this ?

I brought this book with a lot of anticipation but unfortunately I am a bit disappointed now smilie