I have moved my blog to Wordpress at theunixgeek.wordpress.com. I will still be checking back periodically on this one as well, though. 19 April 2009


Merging Mkdir and Cd | 280 Slides Interview | I Switched to KDE 4

clickable portals

Thursday, October 4, 2007

The Power of Java

For me, Java is turning out to be a very powerful language. I'm loving the built-in actions for objects, like Math.sin(x) or string1.equals(s2); I find it less painful than imporing library files (like in C). Here's an example of Java's powerful non-library-importing abilities; it allows you to test how long it took for your code to run. This can be very useful when testing yoru program out in various systems:

public class TimedProgram{
public static void main(String[] argv){
//Yes; I prefer "argv" over "args"
long startTime;
long endTime;
double time;

startTime = System.currentTimeMillis();


endTime = System.currentTimeMillis();
time = (endTime - startTime) / 1000.0;
System.out.print("Total time to run code (seconds): ");