Arithmetic in Java


Figure 26.10 shows the source code for a Java application that receives in a numeric value, performs some arithmetic against the value and prints the result:

      JAVA doMath 9 

image from book
Figure 26.10: Java application using Arithmetic.

This line of code invokes the doMath Java application and passes it a single argument of 9. The application prints the following values:

  • 10

  • 15

It is important to note that, in this example, a Floating point class instance named F was used rather than a floating point variable. Either would work: It's primarily a matter of preference.



IBM i5/iSeries Primer(c) Concepts and Techniques for Programmers, Administrators, and Sys[... ]ators
IBM i5/iSeries Primer(c) Concepts and Techniques for Programmers, Administrators, and Sys[... ]ators
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 245

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