22 Şubat 2024 Perşembe

Kotlin Mp3 Player Örneği

```kotlin
class Mp3Player {
    fun playSong(songName: String) {
        println("Playing song: $songName")
    }

    fun pauseSong() {
        println("Song paused")
    }

    fun stopSong() {
        println("Song stopped")
    }
}

fun main() {
    val mp3Player = Mp3Player()

    mp3Player.playSong("Shape of You")
    mp3Player.pauseSong()
    mp3Player.playSong("Despacito")
    mp3Player.stopSong()
}
```

Output:
```
Playing song: Shape of You
Song paused
Playing song: Despacito
Song stopped
```

Hiç yorum yok:

Yorum Gönder