Android Developers Blog
The latest Android and Google Play news for app and game developers.
🔍
Platform Android Studio Google Play Jetpack Kotlin Docs News

21 мая 2018

Learn Kotlin Fast with new Kotlin Bootcamp course


Link copied to clipboard

Posted by Aleks Haecky, Training Developer & Word Artist, Google+, LinkedIn, Medium

The Kotlin Bootcamp Udacity course is a free, self-paced online course that teaches you the basics of the Kotlin programming language. This introduction to Kotlin was created by Google experts in collaboration with Udacity and is for people who already know how to program.

The Kotlin language lets you create apps in less time, writing less code, and with fewer errors.

This modern object-oriented language offers a strong type system, type inference, null safety, properties, lambdas, extensions, coroutines, higher-order functions, and many other features. Kotlin is so concise that you can create complete data classes with a single line of code.

Kotlin is officially supported for building Android apps, fully interoperates with the Java programming language and libraries, and is included with IntelliJ and Android Studio.

In this course you will learn everything you need to program in Kotlin, including:

  1. Basics: Write Kotlin statements and expressions in the IntelliJ REPL Kotlin interpreter using nullable and non-nullable variables, data types, operators, and control structures.
  2. Functions: Create a main() function, create and call functions with default and variable arguments, pass functions as arguments to filters, program simple lambdas, function types, and compact single-expression functions.
  3. Classes: Create a class with methods and properties. Implement constructors and init(). Learn about inheritance, interfaces, and abstract classes. Use the special purpose classes data, object, enum, and sealed.
  4. Beyond the Basics: Dive deeper into Pairs, collections, and constants. Learn how to write extensions, implement generics, apply annotations, and use labeled breaks.
  5. Functional Manipulation: Explore more about lambdas, higher-order functions, and inline.

You'll learn how to use extension functions to add helpful functionality to existing classes.

Extend built-in types:

fun Int.print() = println(this)
5.print() // prints 5

Extend Android classes:

fun Context.toast(text: CharSequence, duration: Int = Toast.LENGTH_SHORT): Toast {
   return Toast.makeText(this, text, duration).apply { show() }
}
toast("Hello Toast")

Extend your own classes:

class AquariumPlant(
       val color: String)

fun AquariumPlant.print() =
       println("Pretty Aquarium Plant")

val plant = AquariumPlant("green")
plant.print()
// prints -> Pretty Aquarium Plant

When you've completed the course, you will be able to create programs in Kotlin, taking advantage of the features and capabilities that make Kotlin unique.

The course is available free, online at Udacity; take it in your own time at your own pace.

Go learn how to build apps with less code at https://www.udacity.com/course/ud9011.