
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1952 Articles for Apps/Applications

3K+ Views
Kotlin has been developed over JVM, hence it supports most of the features of JVM. Java provides a feature called anonymous inner classes to handle the cases where we have to create an object of a class with a slight modification, without declaring a new subclass. An anonymous inner class doesn't have a name; we define it directly at the instantiation line.However, Kotlin uses object expressions to provide the same sub-class functionality. In Kotlin, we can create an object expression of an interface by implementing its abstract methods. This implementation technique is known as anonymous interface.Example – Anonymous Interface in ... Read More

3K+ Views
Kotlin has been developed over JVM and hence it is fully compatible with JVM. Java POJO class stands for Plain Old Java Object (POJO) which is used to hold the data.In Java, along with defining the variables, we need to create different supporting methods in order to access those private members of the class.But Kotlin provides a unique way to declare a POJO class by introducing the "data" keyword. It can be applied along with class.Once a class is defined as data class, the Kotlin compiler itself will be creating all the supporting getter() and setter() methods for this class.Example ... Read More

688 Views
Properties in Kotlin can be declared either as mutable using the "var" keyword or as read-only using the "val" keyword. Both these types of variables can be referred by their respective names after the method declaration.In Kotlin, getter() and setter() methods need not be created explicitly. The Kotlin library provides both of them by default.ExampleIn this example, we will see how to use the getter() and setter() methods in Kotlin.fun main(args: Array) { // getter() println("Name is -> " + Address().name) println("City is -> " + Address().city) println("State is -> " + Address().state) } class Address ... Read More

2K+ Views
Both these functions, isNullOrEmpty and isNullOrBlank, are used in Kotlin whenever it is required to check if a String value is empty or not. Let's check how these two functions are different from each other.isNullOrBlank – It takes whitespaces into account, which means " " is different from "". This function will return True only when the String is declared with no characters in it. It will check whether the value of the String is NULL and it will also check whether the String is blank.isNullOrEmpty() – This function checks whether the string is declared as NULL or whether it ... Read More

8K+ Views
In this article, we will take an example to show the difference between IntArray and Arrayin Kotlin.IntArray in KotlinIntArray is a class in Kotlin representing the array of elements. Each instance of this class is represented as an integer array. To the constructor of this class you need to pass the number of elements you need in the array (size).You can instantiate this class as shown below −val myArray = IntArray(8)By default, all the elements of the created array will be initialized to "0".ExampleThe following program creates an array of integers by instantiating the IntArray class −fun main(args: Array) { ... Read More

408 Views
In Kotlin, the "===" operator checks the referential equality of two objects. Any expression "a===b" will evaluate to True if and only if both "a" and "b" point to the same object. That is, both "a" and "b" share the same address.In contrast, we can use the "==" operator to check structural equality which implies that two objects have equivalent content. Basically, "==" is a check for equals().Example: "===" Operator in Kotlinfun main(args: Array) { var str1 : String = "That's it" var str2 : String = "It's OK" var str3 : String = str1 ... Read More

8K+ Views
In Java, once a method is declared as "static", it can be used in different classes without creating an object. With static methods, we don't have to create the same boilerplate code for each and every class. Here we will take an example to demonstrate how Kotlin implements static methods.Example – Static Method in Kotlin using Companion ObjectIn order to implement a static method in Kotlin, we will take the help of "companion objects".Companion objects are the singleton objects whose properties and functions are tied to a class but not to the instance of that class. Hence, we can access ... Read More

868 Views
A List is a collection where you can store same type of data in one place. There are two types of lists in Kotlin −An Immutable list is something that cannot be modified. It is read-only in nature.The other type of list is mutable which can be modified.In this article, we will see how to create a mutable list and how to add an item to the existing list.Example – Adding an Item to a Mutable ListIn order to add an item to a list, we will be using add() that is provided by the Kotlin library class.fun main(args: Array) ... Read More

4K+ Views
Kotlin is a statistically typed language and it is based on Java, hence all the Java codes can easily be compiled within Kotlin. In this article, we will see how we can generate the current local date and time in Kotlin.As Kotlin is interoperable with Java, we will be using the Java utility class and Simple Date Format class in order to get the current local date and time.Example – Current Date and time using SimpleDateFormatimport java.text.SimpleDateFormat import java.util.* fun main(args: Array) { val simpleDate = SimpleDateFormat("dd/M/yyyy hh:mm:ss") val currentDate = simpleDate.format(Date()) println(" Current Date is: ... Read More

1K+ Views
Kotlin is statistically typed language and it is built on JVM. Kotlin is cent percent comparable with Java. Hence, some of the Java functions can be used in Kotlin as well.In this article, we will take an example to demonstrate how we can use a Java class function convert an Int in Kotlin to its correponding Hex String.Example – Converting Int to Hex String in KotlinIn this example, we will use the Java class function toHexString().import java.lang.* fun main(args: Array) { val hexString = java.lang.Integer.toHexString(-66) println("Hex String for negative Number: " +hexString) val positiveNumber ... Read More