Vaibhav Mojidra's Projects
In Kotlin, inheritance is the mechanism that allows a class to inherit properties and behavior from a parent class. The parent class is also known as the superclass or base class, while the class that inherits from it is known as the subclass or derived class.
When a nested class is marked with a keyword inner, then it will be called as an Inner class. An inner class can be accessed by the data member of the outer class.
In Kotlin, an interface is a collection of abstract methods, properties, and/or default implementations that define a set of behaviors that can be implemented by classes. It defines a contract between the implementing class and the outside world, specifying the methods that a class must implement.
Lambda expressions or functions in Kotlin are anonymous functions that can be used to simplify code by allowing functions to be created on-the-fly and passed as arguments to other functions. Lambdas are particularly useful when working with higher-order functions, which take other functions as arguments or return them as results.
In Kotlin, lists are a type of collection that allows you to store and manipulate a sequence of elements. Kotlin provides a variety of language constructs and standard library functions for handling lists.
Kotlin logical operators are used to determine the logic between two variables or values. Returns true or false.
In Kotlin, maps are a type of collection that allows you to store key-value pairs. Maps are used to associate keys with values, where each key must be unique within the map. Kotlin provides a variety of language constructs and standard library functions for handling maps.
Named arguments is a feature in Kotlin that allows you to pass arguments to a function by specifying the name of the parameter along with the value, instead of relying solely on the order of the parameters.
Kotlin nested class is by default static, hence, it can be accessed without creating any object of that class but with the help of . dot operator. Same time we cannot access members of the outer class inside a nested class.
In Kotlin, every variable and object reference has a type, and that type can be either nullable or non-nullable. A nullable type can hold a value or a special value called null, which means that the variable doesn't point to any object. On the other hand, a non-nullable type can only hold a value and cannot be null.
In Kotlin, overriding is the mechanism that allows a subclass to provide its own implementation of a method or property that is already defined in its superclass. This means that the subclass can replace the original implementation with a new one, tailored to its specific needs.
In Kotlin, a primary constructor is a way to define the primary initialization logic for a class. It is defined in the class header and is called when an object of the class is created.
In Kotlin, property delegation is a language feature that allows you to delegate the implementation of a property to another object. One type of property delegation is the lazy delegation, which allows you to delay the initialization of a property until it is actually used for the first time.
Observable delegation allows you to observe changes to a property and react to those changes. Basically it will work as changeValueListener.
Delegation Vetoable which allows you to veto changes to a property based on certain conditions. That means it will only allow value to change if the given condition is true while re-assigning.
In Kotlin, a range is a sequence of values that can be represented using the range operator ... Ranges are used to represent a continuous sequence of values, such as a range of numbers or characters.
Kotlin relational (comparison) operators are used to compare two values, and returns a Boolean value: either true or false.
Sealed classes are useful in scenarios where you have a restricted set of possible values or states for a type, and you want to ensure that all possible values or states are accounted for in your code.
In Kotlin, a secondary constructor is a way to define additional initialization logic for a class. Unlike the primary constructor, which is defined in the class header, a secondary constructor is defined inside the body of the class.
In Kotlin, sets are a type of collection that allows you to store a unique set of elements. Sets are similar to lists, but they do not allow duplicate elements. Kotlin provides a variety of language constructs and standard library functions for handling sets.
In Kotlin, a singleton is a design pattern that ensures that only one instance of a class is created throughout the application. Properties can be defined in singletons to provide access to the singleton instance or to store state that is shared by all instances of the singleton.
Smart casting is a feature in Kotlin that allows automatic casting of a variable to a more specific type based on certain conditions. This means that you don't have to explicitly cast a variable to a more specific type every time you need to use it.
String interpolation in Kotlin is the process of embedding expressions into string literals to create a new string value. This can be done using the "$" symbol followed by the expression or by wrapping the expression in curly braces "{}" and using it inside the string.
In Kotlin, strings are represented by the String class, which provides various methods to manipulate and process string data. Strings in Kotlin are immutable, which means that once a string object is created, its value cannot be changed.
In Kotlin, type aliases are a way to create a new name for an existing type. They are useful for making code more readable, and for abstracting away the details of a complex type.
The unary operators require only one operand; they perform various operations such as incrementing/decrementing a value by one, negating an expression, or inverting the value of a boolean.
Varargs is a feature in Kotlin that allows you to pass a variable number of arguments to a function. The syntax for declaring a vararg parameter is to put vararg in front of the parameter type.
In Kotlin, variables are used to store data values that can be manipulated throughout the program. When declaring a variable in Kotlin, you need to specify its data type. Kotlin has several built-in data types, including: Byte, Short, Int, Long, Float, Double, Boolean, Char, String.
Kotlin when expression is similar to the switch statement in C, C++ and Java. Kotlin when can be used either as an expression or as a statement, simply like a switch statement in Java. If it is used as an expression, the value of the first matching branch becomes the value of the overall expression.
Kotlin while loop executes its body continuously as long as the specified condition is true. When Kotlin program reaches the while loop, it checks the given condition, if given condition is true then body of the loop gets executed, otherwise program starts executing code available after the body of the while loop.