Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Programming Kotlin

You're reading from   Programming Kotlin Get to grips quickly with the best Java alternative

Arrow left icon
Product type Paperback
Published in Jan 2017
Publisher Packt
ISBN-13 9781787126367
Length 420 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Stefan Bocutiu Stefan Bocutiu
Author Profile Icon Stefan Bocutiu
Stefan Bocutiu
Stephen Samuel Stephen Samuel
Author Profile Icon Stephen Samuel
Stephen Samuel
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Getting Started with Kotlin FREE CHAPTER 2. Kotlin Basics 3. Object-Oriented Programming in Kotlin 4. Functions in Kotlin 5. Higher Order Functions and Functional Programming 6. Properties 7. Null Safety, Reflection, and Annotations 8. Generics 9. Data Classes 10. Collections 11. Testing in Kotlin 12. Microservices with Kotlin 13. Concurrency

Chapter 1. Getting Started with Kotlin

It is time to write code. In this chapter, we will go over and write the typical entry code for every language: the famous Hello World! In order to do that, we will need to set up the initial environment required to develop software with Kotlin. We will provide a few examples using the compiler from the command line, and then we will move towards the typical way of programming using the IDEs and build tools available.

Kotlin is a JVM language, and so the compiler will emit Java bytecode. Because of this, of course, Kotlin code can call Java code, and vice versa! Therefore, you need to have the Java JDK installed on your machine. To be able to write code for Android, where the most recent supported Java version is 6, the compiler needs to translate your code to bytecode that is compatible at least with Java 6. For this book, however, all the code examples will be run with Java JDK 8. If you are new to the JVM world, you can get the latest version from http://www.oracle.com/technetwork/java/javase/downloads/index.html.

In this chapter you will learn how to:

  • Use the command line to compile and execute code written in Kotlin
  • Use the REPL and write Kotlin scripts
  • Create a gradle project with Kotlin enabled
  • Create a Maven project with Kotlin enabled
  • Use IntelliJ to create a Kotlin project
  • Use Eclipse IDE to create a Kotlin project
  • Mix Kotlin and Java code in the same project
You have been reading a chapter from
Programming Kotlin
Published in: Jan 2017
Publisher: Packt
ISBN-13: 9781787126367
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at ₹800/month. Cancel anytime