Skip to content

Commit

Permalink
[ADD/#1] 코틀린 키보드 입력 실습
Browse files Browse the repository at this point in the history
  • Loading branch information
b1urrrr committed Nov 16, 2023
1 parent 926dc59 commit 0375104
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions WEEK01/app/src/main/java/com/ocomwan/kotlinbasics/Main.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.ocomwan.kotlinbasics

import java.util.Scanner
import kotlin.random.Random

fun main() {
// Random
var randomNumber = Random.nextInt()
print(randomNumber)

Expand All @@ -11,4 +13,12 @@ fun main() {

val randomDouble = Random.nextDouble(0.0, 1.0) // 0.0 ~ 0.9999...
print(randomDouble)

// 키보드 입력
val reader = Scanner(System.`in`)

val numberInput = reader.nextInt()
println(numberInput)
val stringInput = reader.next()
println(stringInput)
}

0 comments on commit 0375104

Please sign in to comment.