Kotlin program to find out the factors of a number

In this tutorial, we will learn how to find out the factors of a number in Kotlin. We will show you two different ways- using a for loop and by using a while loop to solve this problem. The programs will print out the factors of a given number one by one. Let's have a look..

Read

Python tutorial to check if a user is eligible for voting or not

In this python tutorial, we will learn how to check if a user is eligible for voting or not. The program will take the age as an input from the user, check the eligibility and then print out the result.

Read

Data class in Kotlin : Explanation with example

Data class in Kotlin is used mainly for classes that holds only data. Keyword 'data' is used to mark a class data class. These classes cann't be used to define any extra functionalities to a class. By default, this class will provide you few methods. In this tutorial, we will learn about data class in Kotlin , its benifit and use cases.

Read

What is primary constructor and secondary constructor in Kotlin

As we know that a constructor is used to construct a class object. In Kotlin, constructors are categorized into two types - primary and secondary. A Kotlin class can have only one primary constructor and multiple secondary constructors. In this tutorial post, we will learn about these constructs and their use cases.

Read

Kotlin program to check if an alphabet is vowel or not

This is a simple Kotlin example to show you how when and if-else condition works in Kotlin. Problem is to find out if an alphabet is vowel or consonent.Our program will print out the result in one statement i.e. if the character is alphabet or vowel. Let's take a look :.

Read

How to convert stacktrace to string in Java

Stack Trace helps to find out the root cause of an exception. Sometimes you may want to save the stack-trace in string format for further analysis, like saving it in your database, sending It to your server etc.

Read

4 different ways to convert a string to double in Java

Converting a string to double in Java is easier than you think. We have a lot of different approaches to do this conversion. In this tutorial, we will learn four different ways to convert a string to double. We will include different examples for each. Let's have a look :.

Read

Java user defined or custom exception example

In java, we have different types of exceptions already available. For example, NullPointerException, ArrayIndexOutOfBoundException , ClassNotFoundException , FileNotFoundException etc. All of these exceptions invokes for specific predefine rules. For example, NullPointerException occurs if we try to do any operation on a null value, ArrayIndexOutOfBoundException occurs if we are trying to access an invalid index of a array etc.

Read

Java Example to empty an Arraylist

To remove all elements from an ArrayList in Java, we have two inbuilt methods - clear() and removeAll(). Both methods can remove all elements from an ArrayList. Both method looks same but there is a difference between them. Even both of them performs differently.

Read

How to add zeros to the start of a number in Java

In this Java tutorial, we will learn how to modify a number by padding zeros at start. For example, if the number is 123 and if we want to add three zeros to the start of this number, it will become 000123. We will show you two different ways to achieve this in this tutorial :.

Read