Java-5강

Methods

- call by name

- call by value

2개 이상을 return 할 수 없음
2개 이상을 넘기고 싶으면 배열을 이용
value copy
- call by reference
  • 배열
  • reference type
을 이용

- variable argument

runtime 때 size가 결정되는 배열을 사용
  • static void method(int … array)
배열의 기호는 쓰지 못하면서 배열의 기능
argument가 가변적(variable)이다.
갯수와 타입을 신경안써도 된다.

method 호출 방법 4가지

call by name, call by value, call by reference, variable argument
[modifiers] return_type method_name([parameter]){
method_body
}
String은 parameter로 쓰면 call by value
static void methodParameters(int n, String y){…}

return

return 아래 쪽에 어떤 문장도 허용하지 않는다.


Hello World 찍는 8가지 방법
local variable 접근하 듯
주소를 통한 접근
클래스 이름으로 접근
주소로 접근하면 멤버변수
주소 없이 접근하면 스태틱

recursive call

method overloading

method 중복정의
overriding과는 차이 – method 재정의
이름이 같고 매개변수는 다르고
주소없이 코딩하기 위해 main은 static 이여야 한다.
new없이 쓸꺼냐 new있이 쓸꺼냐..

Object-Orientation

eclipse 사용
UML
starUML을 이용해서 block diagram 생성, 기호

추천도서

Comment are closed.