Warning: strpos(): needle is not a string or an integer in /home/thebestp/public_html/buildingblocksjava/wp-content/plugins/textlinkads/textlinkads.php on line 175

Warning: strpos(): needle is not a string or an integer in /home/thebestp/public_html/buildingblocksjava/wp-content/plugins/textlinkads/textlinkads.php on line 175

Warning: strpos(): needle is not a string or an integer in /home/thebestp/public_html/buildingblocksjava/wp-content/plugins/textlinkads/textlinkads.php on line 175
Summing Up | Building Blocks Java

Summing Up

If you’ve gotten this far, you’re capable of doing a surprising amount of real work in Java. You may not think so since we haven’t yet talked about a lot of the modern features of Java like most of its object orientation, many of the details of working with applets, or threads. However it’s important to realize what you do have. Right now the Java you know is able to handle any problem that past generations have handled with Basic and Fortran 77.

FahrToCelsius is a very basic application that could be written in almost any programming language from the most ancient machine code to the most advanced LISP machine. Nonetheless it is important to notice that Java solves this problem just as easily as would a language more commonly associated with numeric and scientific programming such as Fortran or C. In fact this code was translated almost verbatim from Kernighan and Ritchie. Only a few minor semantic changes were required to produce a valid, efficient Java program. Although Java has many, many features that make it suitable for complex object-oriented applications, it is also fully suitable for classic numerical programs, something that is not true of competitors like SmallTalk or LISP.

In fact Java can outperform even Fortran and C in numerical applications when precision, reliability and portability are more important than speed. Java’s true arrays with bounds checking and its well-defined IEEE 754 floating point data types are especially useful in this regard.

Since there is as of yet no native architecture compiler for Java, it’s too early to throw away your Fortran manuals. CPU intensive applications will still be coded in Fortran. The Java language itself (as opposed to its implementation) is also lacking in a couple of important respects for numeric computation. The lack of an exponentiation operator like Fortran’s ** and the lack of a complex data type are both troublesome to longtime Fortran programmers. However neither is insurmountable.

Would anyone care to write a Fortran to Java translator?

In the next chapter we’ll move beyond the 1970’s to discuss more modern features of Java including Objects, Applets, Event Driven Programming and threads.

Comments are closed.