[ Pobierz całość w formacie PDF ]
.javapackage c05.foreign;import c05.local.*;public class Foreign {public static void main (String[] args) {PackagedClass pc = new PackagedClass();}} ///:~Explain why the compiler generates anerror.Would making the Foreign class part of the c05.localpackage change anything?[ Add Comment ][32]There’s nothing in Java that forces the use of an interpreter.There existnative-code Java compilers that generate a single executablefile.[33]There’s another effect in this case: Since the default constructor is theonly one defined, and it’s private, it will prevent inheritance ofthis class.(A subject that will be introduced in Chapter 6.)[34]However, people often refer to implementation hiding alone asencapsulation.[35]Actually, an inner class can be private or protected, but that’s aspecial case.These will be introduced in Chapter 7.[36]You can also do it by inheriting (Chapter 6) from that class.[ ][ ][ ][ ][ ]Last Update:05/21/2001
[ Pobierz całość w formacie PDF ]