Question: I have a question doing a Java study.
I would like to use another method by calling from the Main class.
This is the source code. 

### Java Main class

```
    public class JavaMain {
    public static void main(String[] args) throws Exception {
        Test t1 = new Test();
        t1.getNumbers();
        // calling calculation method like below
        // t1.getSum(parameters);
    }
}

```

### Java Test class file

```
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Test {
    public Test(){
    }

        public void getNumbers() {
        Scanner sc = new Scanner(System.in);
        int[] ch = new int[3];
        for (int i = 0; i <=2 ; i++) {
            System.out.print((i+1)+" Input the Number: ");
            while (!sc.hasNextInt()) {
                sc.next();
                System.err.println("[ERROR]: Input again : ");
            }
            ch[i] = sc.nextInt();
        }
**// devide below 4 lines to another class**
        int result = ch[0] + ch[1] + ch[2];
        int avg = (ch[0]+ch[1]+ch[2]) /3;
        System.out.println("Sum of Numbers: " + result);
        System.out.println("AVG of Numbers: " + avg);
    }   

    /* Want to do making another method like below:
    public void getSum() {
        sum of parameters from ch[0], ch[1], ch[2]
        and return the result (sum of 3 numbers)
        } */
}

```

Could you help to solve this problem?

Answer: 
@Blauharley answered my question. I was trying to use the addEventListener on a div and not the actual form. I changed my html to look like this and it is working now:

```
    <form id="citySearchForm">

        <div id="weather"></div>

        <p><span id="temp"></span></p>

        <p><span id="wind"></span></p>

    </form>

```
Well, the answer is in the comments for some reason, but I'll but some detail on it. 

As squint and Xufox rightly said, your `searchFormFunc()` actually does very little. It creates two new functions, but only in the scope of `searchFormFunc()`. That means that after `searchFormFunc()` finishes, the two functions it made will be lost to the ether.

Now, if you want to fire those functions when you call `searchFormFunc()` you should make `searchCity` and `getCityResults` into expressions instead of functions. I.E. take off the braces and the `function searchCity()` part. 

If you want the functions to exists, but not to be called yet, remember that you can store functions as function objects. To do this, set a global variable `var a` up top, with the rest of your globals, then when you call your `seachFormFunc()` set `var a = function searchCity(e) {...}`, then you can call your function later by calling `a()`.