본문 바로가기 메뉴 바로가기

취미코딩

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

취미코딩

검색하기 폼
  • 분류 전체보기 (101)
    • Kotlin (25)
    • JAVA (25)
    • HTML, CSS (13)
    • Javascript, jQuery (10)
    • Linux (2)
    • Windows (3)
    • MAC (16)
    • IT (7)
  • 방명록

kotlin enum (1)
18. 코틀린 Enum Class(열거형 클래스) 알아보기

enum Class 를 사용하는 이유 코드가 단순해지며, 가독성 UP 인스 턴스 생성과 상속을 방지, 상수값의 타입 안정성 보장 enum class Direction { NORTH, SOUTH, WEST, EAST } fun main(args: Array) { getDirection(Direction.NORTH) getDirection(Direction.SOUTH) getDirection(Direction.WEST) getDirection(Direction.EAST) } fun getDirection(d : Direction){ when(d){ Direction.NORTH -> println("북쪽") Direction.SOUTH -> println("남쪽") Direction.WEST -> printl..

Kotlin 2019. 5. 30. 13:57
이전 1 다음
이전 다음
최근에 올라온 글
최근에 달린 댓글

Blog is powered by Tistory / Designed by Tistory

티스토리툴바