![]() In this post, we’ll take a quick look at how to develop an app in Kotlin. Kotlin has garnered so much interest that Google even recommends it over Java for developing Android apps. In Kotlin, this is much shorter: // Kotlin val input = "What is the answer to the Ultimate Question of Life, the Universe, and Everything? 42" val answer = input.substringAfter("?") println(answer) You must first get the index of the character you want to be in the substring, add one (since strings are zero-indexed), and call to write to stdout. Consider, for example, printing a substring in Java: // Java String input = "What is the answer to the Ultimate Question of Life, the Universe, and Everything? 42" String answer = input.substring(input.indexOf("?") + 1) (answer) Still, its strength lies in the fact that it prioritizes legibility in a way that Java does not. Because of the JVM, it has no real performance advantages over regular Java. In the last ten years, more and more languages that run on the JVM have developed but look and feel nothing like Java. While Java as a programming language survives to this day, it is often viewed as cumbersome, stodgy, and representative of an outdated approach to implementing solutions. To Java’s credit, the JVM was (and still is!) an incredibly fine-tuned runtime that abstracted away a computer’s underlying hardware. ![]() It was able to do so in part by a runtime known as the Java Virtual Machine, or JVM. The idea was that a programmer could develop an app in Java, have it compiled down to bytecode, and become an executable that can run on any platform, regardless of operating system or platform. Since its earliest release, Java has touted itself as a “ write once, run everywhere” programming language. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |