Chapter 4. Moving from C to Java


Chapter 4. Moving from C++ to Java

If you are moving from C++ to Java there is good news. The transition from C++ to Java is easier than the transition from C or Fortran to Java. The developers of Java based their language in part on C++. Much of the basic syntax is the same. Java is also an object-oriented language. You will still be defining classes, constructors, and so on. One way to think about Java is that it is a streamlined, expanded, purely object-oriented version of C++.

The language is streamlined because the developers of Java sought to include many of the more useful features of C++ while eliminating things that were of marginal value and/or could lead you into trouble. One of the key goals of the developers of Java was to eliminate the redundancies that exist in both C++ and C. For example, there is no need to support structures and unions in addition to classes. Anything you would do with a structure or union, you can do with a class. Java is expanded with respect to C++ because Java can do a lot of things that C++ cannot. For example, Java has a built-in capability for multithreaded programming. You can add GUI front-ends to your programs using Java. The Java language is also designed to access and make use of the Internet. You can create Web-based scientific or engineering applications that can be accessed over the Internet via a web browser.

In this chapter we will look at some of the main differences between C++ and Java. We will also examine some of the things that a C++ programmer will have to change about her way of doing things when she moves over to Java. The specific topics we will cover in this chapter are ”

  • Basic syntax

  • Preprocessor directives

  • Data types

  • Pointers

  • Structures, unions, enumerations

  • Inheritance and interfaces

  • Built-in math functions

  • Standard I/O streams

  • Strings

  • Memory management



Technical Java. Applications for Science and Engineering
Technical Java: Applications for Science and Engineering
ISBN: 0131018159
EAN: 2147483647
Year: 2003
Pages: 281
Authors: Grant Palmer

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net