プログラム構造 (COBOL、Java)

COBOL Java
class-id MicroFocus.Examples.HelloWorld.
*> member variable
01 field1           binary-long. 

method-id Main static(args as string occurs any).
    declare nam as string = "Bob"
    *> See if an argument was passed from the command line
    if size of args > 0
        set nam to args[0] *> [] means 0 based index
    end-if
    display "Hello " & nam & "!"
end method.

end class.
public class program_structure
{
    // Member variable 
    private String field1 ;
    
    public static void main(String[] args)
    {
        String nam = "Bob"; 
        // See if an argument was passed from the command line
        if (args.length > 0)
            nam = args[0]; 

    }

}

これらの例の一部は、ハーディング大学コンピューター サイエンス学部の Frank McCown 博士が作成したもので、クリエイティブ コモンズ ライセンスに基づいて使用が許可されています。