![]() ![]() Java does not provide any ways of protection against the null. More than 70% android app crashes due to null pointer exception of java. Rough estimates indicate that Kotlin requires 40% less line of codes compare to java. So compare to java you will write less amount of code in Kotlin, which increases the speed of your development. It drastically reduces the amount of boilerplate code. Kotlin has really concise code compare to java. Less code takes less time to write, less time to read, and also makes easy to maintain it. There are many tech giants who use Kotlin before Google announces the official support for it.įollowing are seven main features of Kotlin:ĭevelopers always love clean and concise code. Here we discuss the introduction, syntax, and working of apply in Kotlin along with different examples for better understanding.Kotlin provides you some amazing and powerful features over Java. Also, if we need to perform some other operations on an object and it returns some other object, we can utilise it. Moreover, it has some default extension functions for doing something with an object, and it returns the value. In kotlin language has some default scope functions for performing the operations in the kotlin application. In the final example, we used default methods like also(), apply(), and with() methods for to perform the user operations in the application. Str2 = "He is using the DELL Laptop which provided by his office" Str1 = "Sivaraman is the Employee working in XX company" Println("Welcome To My domain its the third example that related to the kotlin apply() method") Example #3ĭata class Third(var str1: String, var str2 : String) In the second example, we used interfaces, classes, and scope methods like (), apply() to implement the application. Web development, programming languages, Software testing & others class name")
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |