General Java Questions I
I recently learned a bit about "inner classes" but this seems to be different...
Q: I m a bit new to Java programming so bear with me. My employer bought a
package of java graphics library programs to support some chart applets
we want to create. We have the source code. I m trying to create a jar
file with all the files I need to run the applet. When I currently run
the applet, the browser java tool says that it can t find
"TextComponent$1.class". I recently learned a bit about "inner classes"
but this seems to be different. The "TextComponent.java" file does
contain some inner classes, but not a class called "1". I m confused.
Is this an inner class? Or is it something else. Any help would be
appreciated. Thanks...
Answer: The TextComponent$1.class is the first anonymous class defined in
TextComponent.java. Since nested (inner) classes are compiled to their own
.class file, they needed unique names. The javac compiler is just creating a
unique file name for an anonymous nested class.
Hi there, does anybody know a good source of design patterns written in JAVA ?
Answer: A pretty good (free to download) book.
http://www.patterndepot.com/put/8/JavaPatterns.htm
Q: Whats the difference between the two: System.err. and System.out? When
should we use System.err?
Answer1: System.out leads the output to the standard output stream (normally
mapped to your console screen), System.err leads the output to the standard error
stream (by default the console, too). the standard output should be used for regular
program output, the standard error for errormessages. If you start your console
program regularly both message types will appear on your screen.
But you may redirect both streams to different destinations (e.g. files), e.g. if you want
to create an error log file where you don t want to be the regualr output in.
On an UNIX you may redirect the output as follows:
java yourprog.class >output.log 2>error.log
this causes your regular output (using System.out) to be stored in output.log and your
error messages (using System.err) to be stored in error.log
Answer2: System.err is a "special" pipe that usually is directed to the standard
consolle. You can redirect the System.out with the normal pipe control (| or >), but
System.err no. If you want to put both the "normal" output and the "error" output to a
file you must use the special redirect 2>.
This allow you to send normal messages into a file or in the /null black hole, but still
receive the error messages on the console.
What is the essential difference between an abstract class and an interface?
What dictates the choice of one over the other?
Answer: You can only extend one class (abstract or not) whereas you can always
file:///F|/a_jsite/350_tips/general_java I.htm (7 of 33) [2001 07 08 11:24:51]






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java web hosting

 

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved