일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- Lambda
- #정규표현식
- jv
- Microservices
- #단축키
- java
- 평가인증
- #Gradle Multi project with IntelliJ
- 년말
- Spring Boot
- docker #docker tutorial
- 감사
- bootstrap
- 2010
- WebJar
- 방법론
- #Microservice
- 프로젝트 시작
- 토익
- #화면캡쳐 #macOS
- 분석 작업
- Today
- Total
사랑해 마니마니
Java 그냥 끄적 끄적 본문
Primitive Type
Reference Type: class, interface, array, enum
final 변수
% 몫 연산자
+= 복합 연산자
<textarea name="code" class="brush:cpp;">
int arr[] = new int[10];
int arr[] = { 1, 2, 3 };
arr.length
for (int num : arr ) {
foo()
}
try {
} catch ( ) {
} finally {
}
</textarea>
&& ||
== !=
condition ? true : false ;
int withdraw(int amount) throws Exception {
throw new Exception("....");\
}
method signature
this
this( ): 생성자 호출
static
final static FINAL_STATIC_VARIABLE
ClassName.finalStaticVariable
extends
super( ... ): Super class 생성자 호출
method overriding
final class: 상속 금지
final method: overriding 금지
abstract: 인스턴스화 금지
abstract method: method implementation을 할수 없다. class도 abstract로 처리해야 함
- 생각해봐 method를 implementation하지 않은 불완전한 놈이 객체 생성을 할 수 있겠니?
> 서브 클래스에서 이 메소드를 반드시 구현하도록 하기 위해서
> Runtime에 서브 클래의 메소드를 호출하기 위해서
interface
interface내 static field: 클래스 내에서 사용하는 상수
단 초기화 필요
interface foo{
final static byte STATE_BORROWED = 1;
}
implements
Type case
instance of
obj instanceof typeName
class Boo{
enum Season {
SPRING, SUMMER, FALL
}
Season.SPRING; 클래스 내부
}
Boo.Season.SPRING; 클래스 외부
Season seasons[] = Season.values();
for (Season season : seasons ){
System.out.println(season)
}
Season season = Season.valueOf("SPRING");
enum Season {
SPRING("봄"), SUMMER("여름"), FALL("가을");
final private String name;
Season(Strig name) {
this.name = name;
}
String value() {
return name;
}
}
Season.SPRING -> season.value();