In this article, we will understand how to how to swap two numbers in Kotlin. This is done using a temporary variable. Below is a demonstration of the same Suppose our input is val1 : 45 val2 : 60 The desired output would be val1 : 60 val2 : 45 Algorithm Step 1 − Start Step 2 − Declare three integers: val1, val2 and tempVal Step 3 − Define the values Step 4 − Assign val1 to temporary variable Step 5 − Assign val2 to val1 Step 6 − Assign temporary tempVal variable to val2 Step 7 ... Read More
In this article, we will understand how to add two numbers. This can be done using the ‘+’ operator. Below is a demonstration of the same Suppose our input is input1 : 10 input2 : 15 The desired output would be Sum : 25 Algorithm Step 1 − Start Step 2 − Declare three integers: val1, val2 and sum Step 3 − Define the integers Step 4 − Add the two values using an addition operator (+) Step 5 − Display the result Step 6 − Stop Example 1 In this example, we will add two numbers ... Read More
In this article, we will understand how to print a string. String is a datatype that contains one or more characters and is enclosed in double quotes(“ ”). Below is a demonstration of the same Suppose our input is − Hello my name is John! The desired output would be The string is: Hello my name is John! Algorithm Step 1 − START Step 2 − Define a string variable Step 3 − Display the string on the console Step 4 − STOP Example 1 In this example, we will print a string using the print() ... Read More
In this article, we will understand how to print an integer. Integer is a primitive data type that contains numbers up to 32 bits. Below is a demonstration of the same − Suppose our input is − 45 The desired output would be − The integer is: 45 Algorithm Step 1 − START Step 2 − Define the integer value in a variable Step 3 − Display it on the console Step 4 − STOP Example 1 In this example, we will simply print an integer using the print() method. First, declare an integer variable, which ... Read More
In this article, we will understand how to print hello world in Kotlin. Hello world is stored as a string format and is printed using ‘print()’ function. Input Suppose our input is Hello World Output The expected out should be Hello World Algorithm Step 1 − START Step 2 − Define a string variable Step 3 − Display the string on the console Step 4 − STOP Example 1 In this example, we will simply display a string “Hello World” using the print() method in Kotlin − fun main() { val inputStr = ... Read More
Python Programming Language is one of the most efficient and user-friendly programming language and have endless uses and applications. Lists declared in Python are analogous to dynamically sized arrays in other programming languages (vector in C++ and ArrayList in Java). A list is simply a collection of items enclosed by [] and separated by commas. In this tutorial, we will learn about the solution and approach to find out all even numbers in a given list using Python. List is one of the most fundamental data structures in python. They are widely used and they store similar contiguous data. A ... Read More
In Python Programming Language, Length is the concept of calculating the entire range of the string that begins from the first character of the string till the last character of the string. Printing and calculating even length in a string is a basic exercise in the programing language. In this tutorial, we will learn about the solution and approach to find out all words in a string having even length. A number is considered odd if it divides by 2 evenly, i.e. leaving no remainder. This property should hold for the length of the words we need. So the ... Read More
In Python Programming Language, Class and Instance are two of object orientation's most crucial ideas. Instances are unique objects made in accordance with the class, whereas classes are templates. The procedure is the same for all objects, although the data may vary. In this tutorial, we will learn about classes in python, how to instantiate them, what attributes are, and the differences between class and instance attribute in Python. Let’s begin with definitions – What is a Class? Classes provide a means of bundling data and functionality together in python. Creating a new class creates a new type of ... Read More
Maven is a powerful open-source project management tool developed by the Apache Group to build and manage any Java-based project. Additionally, this tool makes Java developers' work easier while developing reports, checking the builds, and testing automation setups. As we stated above, Maven is primarily used to build and manage many Java-based projects, Java eclipse project is the integrated development environment (IDE) that often hits to mind. Hence, by reading this article, you will learn everything about Maven automatic build tool and what it means in Java Eclipse Projects. Understanding Maven Maven is a popular automatic build tool that focuses ... Read More
Both Vector and ArrayList implement the List interface, and each of them uses (dynamically resizable) arrays for their internal data structure, similar to using an ordinary array. However, there are many differences between ArrayList and Vector classes hence by reading this article, you will learn what ArrayList and Vector class are and their major difference that helps you to choose which one to opt for. Understanding ArrayList and Vector Class In addition to the Arrays class, Java provides an ArrayList class that can be used to create containers that stores lists of objects. ArrayList is considered to be a growable ... Read More