Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
General <strong>Java</strong> Questions I<br />
-by<br />
Nicolas Delbing and Victor Vishnyakov<br />
Is there a way to provide values for a Vector in the source code, analogous to<br />
array initializers?<br />
Answer: The Vector class constuctors take no arguments other than Collection (since<br />
JDK 1.2), which is abstract, and since a Vector is a structure whose size can change<br />
dynamically, it's contents can only be initialaized through member methods.<br />
--<br />
Mike Lundy<br />
How would I add a help file to a java application?<br />
Would it have to be platform specific, or is there a <strong>Java</strong> api for making help files?<br />
If so, what is it?<br />
Answer: See <strong>Java</strong>Help at http://www.javasoft.com/products/javahelp/<br />
you create HTML pages for the main text, and add some XML files for a hierarchical<br />
table of contents and a map from TOC tags to relative URLs giving document<br />
locations.<br />
What is a Just-In-Time(JIT) compiler?<br />
Answer: It is a JVM that compiles <strong>Java</strong> instructions (called bytecode) into native<br />
machine instructions at run time and then uses this compiled native code when the<br />
corresponding <strong>Java</strong> code is needed. This eliminates the constant overhead of<br />
interpretation which tradition first generation JVM's used.<br />
--<br />
Dave Lee<br />
Is there a collection object like the hashmap or hashtable that stores values in an<br />
ordered path? Vector does this but i need the key/value functionality. hashmaps do<br />
not guarantee the order of the objects.<br />
Answer: Take a look at java.util.TreeMap.<br />
Red-Black tree based implementation of the SortedMap interface. This class<br />
guarantees that the map will be in ascending key order, sorted according to the<br />
natural order for the key's class (see Comparable), or by the comparator provided at<br />
creation time, depending on which constructor is used.<br />
Note that this implementation is not synchronized. If multiple threads access a map<br />
concurrently, and at least one of the threads modifies the map structurally, it must be<br />
synchronized externally.<br />
Most people asked why there is an error, but my question is why this is NOT an<br />
error<br />
Please take a look:<br />
r is a number and s is a character, why can I put them together to make a comparison<br />
without compilation error? Could somebody tell me... thank you<br />
double r = 34.5;<br />
char s = 'c';<br />
if (r > s) {<br />
System.out.println("r > s");<br />
file:///F|/350_t/350_tips/general_java-I.htm (9 of 31) [2002-02-27 21:18:17]