Kotlin 简明教程
Kotlin Tutorial
这篇 Kotlin Tutorial 由经验丰富的 Kotlin 程序员为初学者编写,以帮助他们理解 Kotlin 编程语言的基础知识。完成本教程后,你会发现自己已掌握中等程度的 Kotlin 专业知识,然后你就可以继续向更高层次迈进了。
This Kotlin Tutorial has been prepared by well experienced Kotlin Programmers for the beginners to help them understand the basics of Kotlin Programming Language. After completing this tutorial, you will find yourself at a moderate level of expertise in Kotlin, from where you can take yourself to the next levels.
What is Kotlin?
Kotlin 是一种编程语言,由 JetBrains 于 2011 年推出,它是智能化 Java IDE(名为 Intellij IDEA)的官方设计师。Kotlin 免费,一直都是免费的,并将一直保持免费。它是在 Apache 2.0 许可证下开发的,并且源代码可在 GitHub 上获得。
Kotlin is a programming language introduced by JetBrains in 2011, the official designer of the most intelligent Java IDE, named Intellij IDEA. Kotlin is free, has been free and will remain free. It is developed under the Apache 2.0 license and the source code is available on GitHub.
这是一种强静态类型通用编程语言,可在 JVM 上运行。2017 年,Google 宣布 Kotlin 是 Android 开发的官方语言。Kotlin 是一种开源编程语言,将面向对象编程和函数式功能组合到一个独特的平台中。内容分为多个章节,其中包含与简单而有用的示例相关的主题。
This is a strongly statically typed general-purpose programming language that runs on JVM. In 2017, Google announced Kotlin is an official language for android development. Kotlin is an open source programming language that combines object-oriented programming and functional features into a unique platform. The content is divided into various chapters that contain related topics with simple and useful examples.
目前,Kotlin 主要针对 Java 虚拟机 (JVM),但也可以编译成 JavaScript。Kotlin 受其他流行编程语言的影响,例如 Java、C#、JavaScript、Scala 和 Groovy。Kotlin 的语法可能与 Java 编程语言不太相同,但 Kotlin 在内部依赖于现有的 Java 类库来为程序员提供精彩的结果。Kotlin 为世界各地的开发者提供了互操作性、代码安全性和清晰度。
Currently, Kotlin mainly targets the Java Virtual Machine (JVM), but also compiles to JavaScript. Kotlin is influenced by other popular programming languages such as Java, C#, JavaScript, Scala and Groovy. The syntax of Kotlin may not be exactly similar to Java Programming Language, however, internally Kotlin is reliant on the existing Java Class library to produce wonderful results for the programmers. Kotlin provides interoperability, code safety, and clarity to the developers around the world.
Kotlin Jobs
Kotlin 的需求非常旺盛,所有大公司都转向 Kotlin 来开发其 Web 和移动应用程序。
Kotlin is very high in demand and all major companies are moving towards Kotlin to develop their web and mobile applications.
Kotlin 开发人员的平均年薪约为 130,000 美元。虽然它可能因地点而异。以下是在使用 Kotlin 的大型公司:
Average annual salary for a Kotlin developer is around $130,000. Though it can vary depending on the location. Following are the great companies who are using Kotlin:
-
Google
-
Amazon
-
Netflix
-
Pinterest
-
Uber
-
Trello
-
Coursera
-
Basecamp
-
Corda
-
JetBrains
-
Many more…
因此,你可能是上述任何一家大公司的下一个潜在员工。我们已为 Kotlin 开发了大量的学习材料,这将帮助你为基于 Kotlin 的技术面试和认证考试做好准备。因此,无论何时何地,都可以按照自己的节奏开始使用我们简单而有效的教程学习 Kotlin。
So, you could be the next potential employee for any of these major companies. We have develop a great learning material for Kotlin which will help you to prepare for the technical interviews and certification exams based on Kotlin. So, start learning Kotlin using our simple and effective tutorial anywhere and anytime absolutely at your pace.
Kotlin Online Compiler
我们提供了 Kotlin Online Compiler ,可帮助你直接从浏览器 Edit 和 Execute 代码。尝试单击图标来运行以下 Kotlin 代码以打印常规的“Hello, World!”。
We have provided Kotlin Online Compiler which helps you to Edit and Execute the code directly from your browser. Try to click the icon to run the following Kotlin code to print conventional "Hello, World!".
fun main() {
var string: String = "Hello, World!" // defining a variable
println("$string")
}
Quizzes & Assignments
本 Kotlin 教程可帮助你为技术面试和认证考试做好准备。我们提供了各种测验和作业来检查你的学习水平。提供的测验有多项选择题及其答案,并有简短的解释。
This Kotlin tutorial helps you prepare for technical interviews and certification exams. We have provided various quizzes and assignments to check your learning level. Given quizzes have multiple choice type of questions and their answers with short explanation.
以下是样本测验,请尝试回答任何给定的答案:
Following is a sample quiz, try to attempt any of the given answers:
Audience of Kotlin
本教程是为初学者编写的,以帮助他们理解 Kotlin 编程语言的基础知识。完成本教程后,你会发现自己已掌握中等程度的 Kotlin 专业知识,然后你就可以继续向更高层次迈进了。
This tutorial has been prepared for the beginners to help them understand the basics of Kotlin programming language. After completing this tutorial, you will find yourself at a moderate level of expertise in Kotlin, from where you can take yourself to the next levels.
Prerequisites to Learn Kotlin
在继续阅读本教程之前,您应该对 Java 编程语言有基本了解。尽管这是一个初学者教程,我们假设读者对任何编程环境都有合理的了解,并且知道变量、命令、语法等基本概念。我们强烈建议您在继续学习 Kotlin 编程之前,先了解一些 Java 编程语言的基础知识。
Before proceeding with this tutorial you should have a basic understanding of Java programming language. Although it is a beginners tutorial, we assume that the readers have a reasonable exposure to any programming environment and knowledge of basic concepts such as variables, commands, syntax, etc. We strongly recommend that you gain some basic knowledge of Java programming language before proceeding with Kotlin programming.
Kotlin Questions & Answers
您可以在 Kotlin Questions & Answers 浏览一系列 Kotlin 问答
You can explore a set of Kotlin Questions and Answers at Kotlin Questions & Answers