General Java Questions I
public Object nextElement(){
index++;
return e.nextElement();
}
public int size(){
return size;
}
public int getIndex(){
return index;
}
}
by Nicolas Delbing and Victor Vishnyakov
Is there a way to provide values for a Vector in the source code, analogous to
array initializers?
Answer: The Vector class constuctors take no arguments other than Collection (since
JDK 1.2), which is abstract, and since a Vector is a structure whose size can change
dynamically, it s contents can only be initialaized through member methods.
Mike Lundy
How would I add a help file to a java application?
Would it have to be platform specific, or is there a Java api for making help files?
If so, what is it?
Answer: See JavaHelp at
http://www.javasoft.com/products/javahelp/
you create HTML pages for the main text, and add some XML files for a hierarchical
table of contents and a map from TOC tags to relative URLs giving document
locations.
What is a Just In Time(JIT) compiler?
Answer: It is a JVM that compiles Java instructions (called bytecode) into native
machine instructions at run time and then uses this compiled native code when the
corresponding Java code is needed. This eliminates the constant overhead of
interpretation which tradition first generation JVM s used.
Dave Lee
Is there a collection object like the hashmap or hashtable that stores values in an
ordered path? Vector does this but i need the key/value functionality. hashmaps do
not guarantee the order of the objects.
Answer: Take a look at java.util.TreeMap.
Red Black tree based implementation of the SortedMap interface. This class
guarantees that the map will be in ascending key order, sorted according to the
natural order for the key s class (see Comparable), or by the comparator provided at
creation time, depending on which constructor is used.
Note that this implementation is not synchronized. If multiple threads access a map
file:///F|/a_jsite/350_tips/general_java I.htm (9 of 33) [2001 07 08 11:24:51]
footer
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved