# Method

* How to use method?

1. 메소드(클래스) 작성 : **메소드는 클래스 영역에서만 정의할 수 있다.**
2. 인스턴스(객체) 생성 : 메소드(클래스)를 사용하기 위해! 사용 = 접근, 조작 등등
3. 메소드 호출

```java
//1.메소드(클래스) 작성
Class MyMath {...}
//2. 인스턴스 생성
Mymath mm = new MyMath();
//3. 메소드 호출
(Mymath return type) result = mm.add(1L,2L);

```

* return statement

return statement can be omitable only void type. Otherwise, return statement is essential.

Not only when if statement is true, include return statement when it is false.

```java
class MyMath {
    int max(int a, int b) {
        if(a > b)
            return a;//when condition is true
        else
            return b;//when condition is false
    }
}
```
