클래스 정의와 사용(2)

static 필드

사용법

  1. 클래스이름.정적필드 ex) Cricle.instanceCount
  2. 객체변수.정적필드 ex) c2.instanceCount

static 메소드

정적 메소드 or 클래스 메소드라고 칭함

호출 방법

클래스이름.정적메소드() ex) Math.sqrt(2.0); Integer.parseInt("12")


final 필드

상수 데이터!

선언할 때 초기값을 지정해줘야 한다.

자주 static과 함께 사용 됨.

final static doulbe PI = 3.141592;