{"id":1447,"date":"2021-11-16T09:49:46","date_gmt":"2021-11-16T09:49:46","guid":{"rendered":"https:\/\/blog.amt.in\/?p=1447"},"modified":"2021-11-16T09:49:46","modified_gmt":"2021-11-16T09:49:46","slug":"introduction-to-kotlin","status":"publish","type":"post","link":"https:\/\/blog.amt.in\/index.php\/2021\/11\/16\/introduction-to-kotlin\/","title":{"rendered":"Introduction to Kotlin"},"content":{"rendered":"<p>Kotlin\u00c2\u00a0is a\u00c2\u00a0statically typed\u00c2\u00a0programming language\u00c2\u00a0that runs on the\u00c2\u00a0Java virtual machine\u00c2\u00a0and also can be compiled to\u00c2\u00a0JavaScript\u00c2\u00a0source code or use the\u00c2\u00a0LLVM\u00c2\u00a0compiler infrastructure. Its primary development is from a team of\u00c2\u00a0JetBrains\u00c2\u00a0programmers based in\u00c2\u00a0Saint Petersburg, Russia.\u00c2\u00a0While the syntax is not compatible with Java, the JVM implementation of Kotlin&#8217;s standard library is designed to inter-operate with\u00c2\u00a0Java\u00c2\u00a0code and is reliant on Java code from the existing\u00c2\u00a0Java Class Library, such as the\u00c2\u00a0collections framework. Kotlin uses aggressive\u00c2\u00a0type inference\u00c2\u00a0to determine the type of values and expressions for which type has been left unstated. This reduces language verbosity relative to Java, which demands often entirely redundant type specifications prior to version 10.<\/p>\n<p>As of\u00c2\u00a0Android Studio 3.0\u00c2\u00a0Kotlin is a fully supported programming language by\u00c2\u00a0Google\u00c2\u00a0on the\u00c2\u00a0Android Operating System, and is directly included in the Android Studio 3.0 IDE package as an alternative to the standard Java compiler. The Android Kotlin compiler lets the user choose between targeting\u00c2\u00a0Java\u00c2\u00a06- or Java 8-compatible bytecode.<\/p>\n<p>Development lead\u00c2\u00a0Andrey Breslav\u00c2\u00a0has said that Kotlin is designed to be an industrial-strength\u00c2\u00a0object-oriented\u00c2\u00a0language, and a &#8220;better language&#8221; than Java, but still be fully inter-operable with Java code, allowing companies to make a gradual migration from Java to Kotlin.<\/p>\n<p>Semicolons\u00c2\u00a0are optional as a\u00c2\u00a0statement\u00c2\u00a0terminator; in most cases a\u00c2\u00a0newline\u00c2\u00a0is sufficient for the\u00c2\u00a0compiler\u00c2\u00a0to deduce that the statement has ended.\u00c2\u00a0Kotlin\u00c2\u00a0variable\u00c2\u00a0declarations and\u00c2\u00a0parameter lists\u00c2\u00a0have the\u00c2\u00a0data type\u00c2\u00a0come after the variable name (and with a\u00c2\u00a0colon\u00c2\u00a0separator), similar to\u00c2\u00a0Pascal.<\/p>\n<p>Variables in Kotlin can be\u00c2\u00a0immutable, declared with the\u00c2\u00a0<span class=\"monospaced\">val<\/span>\u00c2\u00a0keyword, or mutable, declared with the\u00c2\u00a0<span class=\"monospaced\">var<\/span>\u00c2\u00a0keyword.\u00c2\u00a0Class members are public by default, and the classes themselves are sealed by default, meaning that creating a derived class is disabled unless explicit keywords in the base class are present to enable it.<\/p>\n<p>In addition to the\u00c2\u00a0classes\u00c2\u00a0and\u00c2\u00a0methods\u00c2\u00a0(called member functions in Kotlin) of\u00c2\u00a0object-oriented programming, Kotlin also supports\u00c2\u00a0procedural programming\u00c2\u00a0with the use of\u00c2\u00a0functions.<\/p>\n<p>One of the obvious applications of Kotlin is\u00c2\u00a0Android\u00c2\u00a0development. The platform was stuck on Java 7 for a while (with some contemporary language features made accessible through the use of Retro-lambda or the Jack tool-chain) and Kotlin introduces many improvements for programmers such as null-pointer safety, extension functions and infix notation. Accompanied by full Java compatibility and good IDE support (Android Studio) it is intended to improve code readability, give an easier way to extend Android SDK classes and speed up development.<\/p>\n<p>Kotlin was announced as an official Android development language at\u00c2\u00a0Google I\/O\u00c2\u00a02017. It became the third language fully supported for Android, in addition to Java and C++.<\/p>\n<p>Some of the tools that are used for Kotlin are:<\/p>\n<ul>\n<li>IntelliJ IDEA\u00c2\u00a0has plug-in support for Kotlin.\u00c2\u00a0IntelliJ IDEA 15 is the first version to bundle the Kotlin plugin in the IntelliJ Installer, and provide Kotlin support out of the box.<\/li>\n<li>JetBrains also provides a plugin for\u00c2\u00a0Eclipse.<\/li>\n<li>Integration with common Java build tools is supported including\u00c2\u00a0Apache Maven,\u00c2\u00a0Apache Ant,\u00c2\u00a0and\u00c2\u00a0Gradle.<\/li>\n<li>Android Studio\u00c2\u00a0(based on IntelliJ IDEA) has official support for Kotlin, starting from Android Studio 3.<\/li>\n<li>Emacs\u00c2\u00a0has a\u00c2\u00a0Kotlin Mode\u00c2\u00a0in its Melpa package repository.<\/li>\n<li>Many great\u00c2\u00a0libraries\u00c2\u00a0for Kotlin.<\/li>\n<\/ul>\n<p>The above is a brief about Kotlin compiled from various sites. Watch this space for more updates on the latest trends in Technology.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Kotlin\u00c2\u00a0is a\u00c2\u00a0statically typed\u00c2\u00a0programming language\u00c2\u00a0that runs<\/p>\n","protected":false},"author":1,"featured_media":1448,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[197,154,7],"tags":[198,156,18],"class_list":["post-1447","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-kotlin","category-programming-language","category-techtrends","tag-kotlin","tag-programming-language","tag-technology"],"_links":{"self":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/1447","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/comments?post=1447"}],"version-history":[{"count":1,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/1447\/revisions"}],"predecessor-version":[{"id":1449,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/1447\/revisions\/1449"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/media\/1448"}],"wp:attachment":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/media?parent=1447"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/categories?post=1447"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/tags?post=1447"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}