[CSUSB]
>> [CNS]
>> [Comp Sci Dept]
>> [R J Botting]
>> [CSci620]
>>
12
[Source]
. . . . . . . . . ( end of section Topics) <<Contents | Index>>
Questions
There are a collection of methods that apply to all Objects:
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait
plus a constructor.
How do real events connect to mouseXxxx methods?
The library java.awt.event.* essentially contains the software connection
be ween the hardware and the method. The hardware typically send signals
to the computer that interrupt it via the operating system. The event
is created by the Java system and sent to the correct method.
Figure 6.8 tries to show this plus the method handling the
incoming message and handing control back to the in erupted process.
Should an inheriting class only over-ride base-class functions and not add any new ones?
No. One of the main purposes of inheritance is to add new functions.
For example we often have a parent class providing part of the functionality that we want, and the child class supplies another part of it.
In a framework the parent class has abstract methods and classes
that must be provided for the result to be useful.
Can we add polymorphism to Java?
No. It has polymorphism already.
It takes effort to defeat it in Java.
How can we safely inherit from nay classes?
You can't! If to classes have different functions with the
same signature then it is hard to figure out which should
be executed.
But in Java we can implement (inherit) many interfaces safely.
An interface names functions but does not provide what they do.
So you can not get conflicting behaviors. The behavior is
provided by the child class that implements the functions.
So it doesn't matter if two interface both ask us to implement foo(),
we provide the single unambiguous response.
What is System in System.out.println()?
System is a Java Class that contains information and objects
related to the operating system under which the JVM is running.
For more information go to
[ System.html ]
in Sun's documentation.
Why is an Applet self-contained?
An Applet executes in a sandbox or womb. It can not access
parts of the system it is running on unless they are in the
sandbox. So the program runs in a sealed environment -- it is self-contained.
In Figure 6.8 What is the "Interrupted Routine"?
When the user reaches for the mouse and clicks it the computer
will be busy. The Java program will be doing something, and this
something is interrupted by the mouse clicking or moving. Since
it is a program or routine, the result is an "interrupted routine".
Explain Figure 6.8
This shows a sequence of events. Each event is an arrow. The
numbers on the arrows show the sequence of events and the arrows
show the flow of control. Thus (1) the mouse interrupts the processor
which send a mouseEvent to Java. (2) Java stops whatever it was doing
(Interrupted routine) and passes control (3) to a Mouse handler.
This triggers the redrawing of the screen (5) and hands back control
to the previously interrupted routine.
How does the Java Virtual Machine and Java Runtime Environment relate?
The Java Runtime Environment is made up of the Java Virtual Machine
plus the loaded classes. (I think).
Compare the Common Language Run-time and the JVM.
The JVM is designed to support Java and runs on any operating
system or hardware. Thus one language operates on many systems.
The CLR provides a cross-language platform for many languages
and runs mainly on Microsoft operating systems. An language can
be adjusted to work with it on one set of systems.
What is the smallest HTML page that contain an applet.
This is left for lab work.
Should we use /share/java1.1.4.1/.... or /share/j2sdk1.4.1/.... in the labs?
Whichever works. On some machines/accounts the programs seem to
do nothing for ever. Once you know which works for you
you can add the /share/..../bin to your PATH. Do this carefully!
Also, put it before the /share/bin entry in the PATH -- /share/bin
has commands that link to older broken/dismantled versions of Java:-(
The chapter implies that import and extends are similar. Is this true?
No. import statements are freestanding statements at the start of a file
and list any remote packages that are needed to compile/run the code
in the file. The extends word is used as part of a class declaration:
class MyClass extends MyParent ....{....}
Do not use 'import' in a class header!
. . . . . . . . . ( end of section Questions) <<Contents | Index>>
Laboratory
Experiments with Java Applications
[ lab12.html ]
Next
Study pp158-168 Concurrency
[ 13.html ]
. . . . . . . . . ( end of section CS620 Session 12 Java102) <<Contents | Index>>
Glossary