This might help
Here is a simple class below, VCList with main static method for testing, yes the 0d0a could be improved but this show a class with a main method for testing and constructors.
This is from an article I wrote a long time ago.
It demonstrates how well Visual COBOL and JAVA can integrate. It covers the core subjects of CLASSPATH, PACKAGES, BUILDING JAR files and executing programs.
Basically the class is self-contained, and has a static main method for testing.
>>>>>> VCList.cbl
$set sourceformat(variable)
$set ooctrl(+p-f) intlevel"4"
$set ilusing"java.util"
$set ilusing"java.lang"
$set ilusing"com.microfocus.vcexamples.list"
class-id com.microfocus.vcexamples.list.VCList public.
01 ls type List public.
*> no argument constructor
method-id new public.
procedure division.
set ls to new ArrayList[String]
invoke ls::add("one")
invoke ls::add("Three")
invoke ls::add("two")
invoke ls::add("four")
end method.
*> constructor passing a List
method-id new public.
procedure division using by reference ls as type List.
set self::ls to new ArrayList(ls);
end method.
*> just exercise class for getting lists about
method-id toString override.
01 sb type StringBuffer.
01 val string.
procedure division returning lnkmessage as string.
set sb to new StringBuffer
perform varying val through ls
invoke sb::append("<")
invoke sb::append(val)
invoke sb::append(">")
invoke sb::append(x'0d0a') *> dont handle \n
end-perform
set lnkmessage to sb::toString()
end method.
*>
*> main entry point
*>
method-id main public static.
local-storage section.
linkage section.
01 args type String occurs any.
procedure division using by value args.
*> Create the VCList
*> use the declare and create syntax
declare tstVCList as type VCList
create tstVCList
display "Visual Cobol the VCList at start :"
display "using List::tostring : ", tstVCList::ls
display "using VCList::tostring : "
display tstVCList
*> Fire of a core java static method to sort
invoke type Collections::sort(tstVCList::ls, String::CASE_INSENSITIVE_ORDER)
display "Visual Cobol the VCList after sort :"
display "using List::tostring : ", tstVCList::ls
display "using VCList::tostring : "
display tstVCList
end method.
end class.
>>>>>>