|
meovino=/SPx079MrvAgMxX8nMqP6gC/G2K4zDHf@public.gmane.org wrote:
>
> I have re-read the chapter several times, and it looks as if I need to call
> the Java method passing an instance parameter as the first parm.
> Unfortunately, the book does not appear to give any examples of calling a
> non-static method that does not return a value. The method is defined as
> follows:
>
> public class conversionTest
> {
>
> public conversionTest(File f, int format)
>
Ok, I get it now. A method whose name is the same as the class name is
called a "constructor". It returns an object of the class. In RPG, you
prototype it with the special method name *CONSTRUCTOR, and define it to
return an object. (But you don't have to code the CLASS keyword for the
return value.)
D Class1 C 'conversionTest'
* conversionTest constructor
* Java: public conversionTest(File f, int format);
D newConversionTest...
D PR O ExtProc(*JAVA:
D Class1:*CONSTRUCTOR)
* method parameters
D f O Class(*JAVA:'java.io.File')
D Const
D format 10I 0 Value
D obj S O Class(*JAVA:Class1)
c eval obj = newConversionTest (fFile : format)
It's a good idea to put the Java version of the method header as a
comment in the RPG.
Sorry if I was a bit snarky before. As well as reading about RPG and
Java, I think it's important for you to read a bit about Java. Sun has
a nice tutorial here:
http://java.sun.com/docs/books/tutorial/java/index.html.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.