static 멤버(변수, 메소드)
특징
제약
this 키워드 ❌
non-static 멤버 접근 ❌
non-static
- 객체 생성시 객체당 멤버 공간 생성
- non-static메소드에서 static 멤버 접근 ⭕
활용
public static int COUNT = 0;
오늘의 날짜, 숫자에 콤마 추가..
java.lang 패키지의 Math 클래스
public final class Math {
public static int abs(int a);
public static double cos(double a);
public static int max(int a, int b);
public static double random(;
...
}
// 사용시
int n = Math.abs(-5);