Page 1 of 1

JAVA Library

Posted: Sun Apr 14, 2002 3:59 pm
by C8H10N4O2
What advantages do JAVA libraries provide over STL? Are they significant enough to warrant me to switch languages to stay competitive?

Posted: Mon Apr 15, 2002 4:25 am
by Stefan Pochmann
Depends on your goals. If you want to write applications, you might like the graphics components of Java. It also has arbitrary precision arithmetics, regular expressions, some geometry algorithms (in AWT) and lots of other useful stuff. Unfortunately, I don't think much of it is available on the online judge here.

Question for the admins: Could you give us a list of packages or classes of Java that you support? Or the ones that you disable? Or whatever your mechanism is? Which Java version do you run?

As for competitiveness on the online judge: so far I've only used Java in the ICPC when I needed BigInteger. As this is probably still not enabled here, I see no real advantage of Java, only disadvantages, such as parsing/formatting and lack of templates and operator overloading.

Posted: Mon Apr 15, 2002 6:23 am
by C8H10N4O2
You mentioned BigInt on the ICPC. That is exactly what I am trying to find out. Should I get a few years of JAVA experience before I go to the ICPC? :wink:

Posted: Mon Apr 15, 2002 6:40 am
by Stefan Pochmann
No, a few weeks (or even days) should be enough. If you don't use all that fancy object oriented stuff and the huge library (most of which will never be of use in the ICPC), then Java code looks pretty much like C++ code.

You should start learning the library with the classes in the package (Input/Output), particularly BufferedReader, StreamTokenizer and Printstream.

Then, I'd suggest you look at the package java.math, with its classes BigInteger and BigDecimal.

Also very useful is stuff in java.util, especially the classes Arrays, Collections, Dictionary, Hashtable, Treemap, Treeset, Vector and StringTokenizer.

Oh, I forgot. Of course the very first package you should look at is java.lang, which contains all the basic types.

Look at the API specification at

It really shouldn't take too long to learn this most useful stuff, but as I said, the BigInteger is probably the only reason you might want to learn Java if it's only for the contest. On the other hand, if you ever want to build a web applet or work for a software company, then knowing Java could be an advantage anyway.