Found 33676 Articles for Programming

Difference between Array and ArrayList

Pradeep Kumar
Updated on 22-Jul-2022 07:14:09

5K+ Views

Programmers should strive to effectively manage data as one of their primary responsibilities. There is a wide variety of data structures available to assist programmers in the process of data handling.The array data structure has been around for a very long time and is one of the most common data structures used to store data. The ease with which array can be implemented is one of the primary reasons for its widespread adoption. This makes it much easier for newcomers to comprehend the data structure.ArrayList is the name of one of the additional provisions that can be found in the ... Read More

Swift Program to Find the Area of a Circle

Ankita Saini
Updated on 29-Jul-2022 10:10:06

1K+ Views

This tutorial will discuss how to write a swift program to find the area of a Circle.In a circle, an area is known as the space that is enclosed inside the boundaries of the circle in the two-dimensional plane. Suppose we have a round tea table now the area of the circle helps us to find how much cloth we required to cover the top of the table. We can calculate the area of the circle with the help of the radius or diameter, here, We are going to use the formula of area of the circle −Area of the ... Read More

Swap Numbers without using temporary variable in Swift Program?

Ankita Saini
Updated on 29-Jul-2022 10:07:16

14K+ Views

This tutorial will discuss how to write a swift program to swap two numbers without using temporary variable. Swapping of two variables means mutually exchanging the values of two variables.Swapping two numbers without using temporary variablesGiven two variables Number1 and Number2 now we swap their values without using any temporary variable. Here we use tuple to preform the swapping operation.AlgorithmThe algorithm is explained below −Step 1 − Declare two integer variables − Number1, and Number2Step 2 − Assign values to Number1 and Number2Step 3 − Use tuple syntax to swap −(Number1, Number2) = (Number2, Number1)Step 4 − Display the value ... Read More

How to Add two Numbers in Swift Program?

Ankita Saini
Updated on 29-Jul-2022 09:53:04

4K+ Views

This tutorial will discuss how to write a swift program to add two numbers.Adding two numbers in Swift language is simple and can be performed with the help of the addition arithmetic operator(+). The arithmetic addition operator (+) uses two numbers as operands and returns their sum as output.In this operator, both the operands should be of the same data types, For example swift allows adding a float into float without an issue but if we will try to add different types of data types using (+) operator then the compiler will raise an error, For example adding an Int ... Read More

How to Print a String in Swift Program?

Ankita Saini
Updated on 29-Jul-2022 09:50:50

954 Views

This tutorial will discuss how to write a swift program toprint a string. A string is a collection of characters such as “TutorialsPoint”, “Hello Purnima! How are you?”, etc. Strings can also be represented by Unicode. We can easily create and modifies a strings because they are lightweight and readable, also we can do string interpolation. Strings can be used to insert variable, constants expressions, etc.SyntaxFollowing is the syntax for creating string type variableVar a : StringAlgorithm to print two stringsStep 1 − Define 2 VariablesStep 2 − Enter string into that variableStep 3 − Perform operations with that stringStep ... Read More

Swift Program to Find the Perimeter of a Circle

Ankita Saini
Updated on 28-Jul-2022 09:53:05

2K+ Views

This tutorial will discuss how to write a Swift program to find the perimeter of the circle.Perimeter of the circle is also known as the circumference of the circle. It is used to calculate the boundary of the circle. Suppose we want to fence our circular garden so with the help of perimeter we can calculate the total amount of fence required to cover the boundary of the garden. We can calculate the perimeter of the circle with the help of the radius or diameter, here, Radius − It is known as the distance from the center to a point ... Read More

Swift Program to Find Area of Square

Ankita Saini
Updated on 28-Jul-2022 09:18:24

3K+ Views

This tutorial will discuss how to write a swift program to find the area of square.A Square is a two-dimensional closed figure with four equal side and four equal angle. It can also have two diagonals of equal length. The area of the square is known as the space that is enclosed inside the boundaries of the square. Suppose we have a square study table now the area of the square helps us to find how much cloth we required to cover the top of the table. The area of the square is the product of its two side.FormulaFollowing is ... Read More

How to use List size() method in Java With Examples?

Vivek Verma
Updated on 26-May-2025 19:39:42

594 Views

In Java, a List is an interface which stores a sequence of elements of similar types. Since the list contains multiple elements, we might need to know how many element the list currently have. To count the total number of elements present in a list, the List interface provides a method named size(). The List size() Method The size() method of List interface is used to retrieve size of the current List. The size refers to total number of items currently the list holds. For example, a list have {1, 2, 3}, then the size of the list will be ... Read More

How to get sublist of List in Java?

Vivek Verma
Updated on 26-May-2025 19:42:36

7K+ Views

In Java, a List is an interface that stores elements of the same type. You can retrieve a sub-list from a List in Java. A sub-list is the view of a portion (or part) of the List. For example, if the given list is {a, b, c, d, e}, then the possible sub-lists can be {a, b}, {a, b, c}, {b, c, d}, {d, e}, etc. The List interface in Java provides a built-in method named subList(), which returns a sub-list from the given List. We just need to specify the range of extraction. Sublist from a List using the ... Read More

How to remove an element from a Java List?

Vivek Verma
Updated on 26-May-2025 19:20:28

5K+ Views

In Java, List is an interface that stores a sequence of elements of similar types. Like an array, elements in the list are stored at a specific index starting at 0. Since we can access elements in the list through their index, and we can pass this index value to the remove() method (i.e., a basic method for removing elements), which will remove the element at the specified index. We can remove an element from the List in Java: Using remove() Method of List Interface Using remove(object) Method ... Read More

Advertisements