Adding new methods

In this section, you will learn how to add a method in your VJET file.

  1. You can add a method by typing the following code at the end of the props if you want to make method static, otherwise you can add the method at protos in Test.js file.

    Note: add the method before the closing brackets of the block.

    //> public int getBalance()
    getBalance: function() {
        return this.balance;
    }

    Add New Method

    As soon as you type the method name in the editor area, the new method appears at the bottom of the Outline view.

    New method in outline view

  2. //> public int getBalance()

    The above statement informs the method access modifiers, return type and parameters type add annotation above your method declaration: As soon as you type the comment in the editor area, our new method will change its icon in the Outline view. In addition, if your method have syntax error. Note that error annotation in the editor's rulers are updated as you type, This behavior can be controlled via the VJET Errors/Warnings option located on the Goto the VJET editor errors/warnings preference page VJET > Editor errors/warnings preference page.

  3. Save the file.

Related reference