본문 바로가기

Study/Kotlin

(6)
Kotlin 기본 문법 따라하기 - 5. Data classes Kotlin 기본 문법 따라하기 https://kotlinlang.org/docs/reference/data-classes.html Data Classes - Kotlin Programming Language kotlinlang.org package com.kotlintest.test class MainDtClass { fun main() { var ssing = User("ssing", 10) println("ssing : ${ssing.toString()}") var kim = ssing.copy(name = "kim") println("kim : ${kim.toString()}") val lee = User1("lee"); lee.age = 10 println("lee : ${lee.toString..
Kotlin 기본 문법 따라하기 - 4. Properties and fields Kotlin 기본 문법 따라하기 https://kotlinlang.org/docs/reference/properties.html Properties and Fields: Getters, Setters, const, lateinit - Kotlin Programming Language kotlinlang.org package com.kotlintest.test class MainProClass() { fun main() { var address = Address() println("city : ${address.city} - ${address.isSeoul}") address.city = "Seoul" println("city : ${address.city} - ${address.isSeoul}") pri..
Kotlin 기본 문법 따라하기 - 3. Class Kotlin 기본 문법 따라하기 https://kotlinlang.org/docs/reference/classes.html Classes and Inheritance - Kotlin Programming Language kotlinlang.org package com.kotlintest.test import com.sun.tools.doclets.internal.toolkit.util.DocPath.parent class MainClzClass() { fun main() { val person1 = Person("kim"); println("person1 : ${person1.name} ${person1.age} ${person1.birthday}") val person2 = Person("lee", 1..
Kotlin 기본 문법 따라하기 - 2. BasicType Kotlin 기본 문법 따라하기 https://kotlinlang.org/docs/reference/basic-types.html Basic Types: Numbers, Strings, Arrays - Kotlin Programming Language kotlinlang.org package com.kotlintest.test import java.awt.SystemColor.text import javax.xml.bind.DatatypeConverter.printDouble class BasicType { fun main() { val one = 1 // Int val threeBillion = 3000000000 // Long val oneLong = 1L // Long val oneByte: Byt..
Kotlin 기본 문법 따라하기 - 1. Basic Syntax Kotlin 기본 문법 따라하기 https://kotlinlang.org/docs/reference/basic-syntax.html Basic Syntax - Kotlin Programming Language kotlinlang.org package com.kotlintest.test import java.lang.Integer.parseInt class BasicSyntax{ fun main() { println("Hello Kotlin") println("sum(1, 2) : ${sum(1, 2)}") println("sumOneLine(3, 4) : ${sumOneLine(3, 4)}") printSum(5, 6) variable() println("maxOf(7, 8) : ${maxOf(7, 8)..
Kotlin - SpringBoot + Kotlin 프로젝트 생성 1. 프로젝트 생성 1-1. IntelliJ > New Project > Spring Initializr 1-2. Project Metadata Group : com.springboot.kotlin Artifact : springboot-kotlin Type : Maven Project Language : Kotlin Package : com.kotlintest 1-3. Dependency Spring Web Thymeleaf 1-4. pom.xml 4.0.0 org.springframework.boot spring-boot-starter-parent 2.2.4.RELEASE com.springboot.kotlin springboot-kotlin 0.0.1-SNAPSHOT springboot-kotlin..