Thursday, November 14, 2019

Java_Lesson(3) Overloading Methods

All is well woth yesterdays's code, which I can
also run on the command prompt. Copy the code to One Note,
file name is that of the project .java. On Command Prompt,
compile with javac, then run with java. Note that a class file is
created after the compilation. Project run thanks to the presence of the
JRE.




*     *     *

Today's problem will be a bit trickier. We are going to enter some
numbers which need to be added; only thing, user can enter whole
or decimal numbers and the program should be able to respond
to either eventuality.

The topic is overloaded methods...


  *     *     *
A program can only have one main method: it is the
actual scenario of the program.

Note that it is ''void' ie returns nothing. It is the ancillary 
Math class that got the work done.



The terms 'int' and 'double' regulate the amount of memory allocated
by the runtime. If it is wrong, the program will stall...

unless one has specified an exception ...

No comments: