Found 31502 Articles for Programming

Check a Subarray is Formed by Consecutive Integers from a Given Array in Java

Mr. Satyabrata
Updated on 30-Jan-2023 16:49:28
In Java, Array is an object. It is a non-primitive data type which stores values of similar data type. As per the problem statement we have to check if a sub array is formed by consecutive integers from a given array of integers. The sub array refers to some segment of the array from an array. Here it has been told to check the subarray formed by consecutive integers elements i.e., the array elements are a set of continuous numbers where we can get one after another element. Let’s explore the article to see how it can be done by ... Read More

Avoid These Mistakes While Learning Java

Mr. Satyabrata
Updated on 30-Jan-2023 16:37:51
Java is one of the most popular programming languages in the world and is the language of choice for many developers and coders. With its wide variety of uses, including web development & mobile app development, it's no wonder that so many people are eager to learn how to work with Java. Java is used to develop various applications, from small desktop programs to large enterprise applications. Learning Java can be a great way to expand your skills and create applications that can have a real impact. The Unrivalled Versatility and Robustness of Java Java has become one of the ... Read More

Advantages and Disadvantages of Java Sockets

Satish Kumar
Updated on 30-Jan-2023 10:23:19
Java Sockets are a powerful tool for creating network-based applications in the Java programming language. They allow for communication between different computers and devices, making it possible to create client-server applications, peer-to-peer networks, and other types of network-based systems. However, like any programming tool, Java Sockets have both advantages and disadvantages that need to be considered when designing and implementing network-based systems. Advantages of Java Sockets Platform Independence One of the biggest advantages of Java Sockets is that they are platform-independent. This means that the same Java code can be run on multiple operating systems and devices without the need ... Read More

Swift Program to remove the last given number of items from the array

Ankita Saini
Updated on 27-Jan-2023 12:38:26
In this article, we will learn how to write a swift program to remove the last given number of items from the array. An array is used to store elements of same data type in an order. So, here we use the following methods to remove the last given number of items from the array − Using removeLast(_:) function Using dropLast(_:) function Using removeSubrange() function Method 1: Using removeLast(_:) Function Swift provide an in-built function named as removeLast() function to remove the specified number of items from the end of the array. Syntax func removeLast(_x: Int) ... Read More

Swift Program to remove the first given number of items from the array

Ankita Saini
Updated on 27-Jan-2023 12:34:59
In this article, we will learn how to write a swift program to remove the first given number of items from the array. An array is used to store elements of same data type in an order. So, here we use the following methods to remove the first given number of items from the array − Using removeFirst(_:) function Using dropFirst(_:) function Using removeSubrange() function Method 1: Using removeFirst(_:) Function Swift provide an in-built function named as removeFirst() function to remove the specified number of items from the start of the array. Syntax func removeFirst(_x: Int) ... Read More

Swift Program to Print object of a class

Ankita Saini
Updated on 27-Jan-2023 12:33:02
In this article, we will learn how to write a swift program to print object of a class. A class object is known as an instance of a class. For example, colour is a class then obj1, obj2, obj3 and obj4 are the objects from the class. A class can have multiple objects. Syntax var objectname = Classname() Here, using the above syntax we can create an object of a class. Algorithm Step 1 − Create a class with properties and a constructor. Step 2 − Create a function to print the object of the given class. Step ... Read More

Swift Program to get the last given number of items from the array

Ankita Saini
Updated on 27-Jan-2023 12:30:54
In this article, we will learn how to write a swift program to get the last given number of items from the array. An array is used to store elements of same data type in an order. So, here we are using the following methods to get the last given number of items from the array − Using user defined function Using suffix(_:) function Using suffix(from:) function Method 1: Using a user-defined function To get the last given number of items from the array we can create a function. This function will return an array containing the ... Read More

Swift Program to get the first given number of items from the array

Ankita Saini
Updated on 27-Jan-2023 12:29:23
In this article, we will learn how to write a swift program to get the first given number of items from the array. An array stores elements of the same data type in order. Therefore, here we use the following methods to get the first given number of items from the array − Using subscript with range Using prefix(_:) function Using prefix(upTo:) function Method 1: Using subscript with range To get the first given number of items from the array we can use subscript with different range operators like closed range operator, closed range operator with one-sided ranges, ... Read More

Swift Program to fill an array with a specific element

Ankita Saini
Updated on 27-Jan-2023 12:28:31
In this article, we will learn how to write a swift program to fill an array with a specific element. An array is used to store elements of same data type in an order whereas a set is used to store distinct elements of same data type without any definite order. In an array, every element has an index. The array index is start from 0 and goes up to N-1. Here N represent the total number of array elements. We can fill an array with a specified element using the following methods − Using user defined function Using ... Read More

Python program to Uppercase selective indices

Vikram Chiluka
Updated on 27-Jan-2023 12:22:26
In this article, we will learn a python program to convert the string elements to uppercase for the given selective indices. Methods Used The following are the various methods to accomplish this task − Using For Loop and upper() function Using List Comprehension Using index() & join() functions Example Assume we have taken an input string and a list containing index values. We will now convert the characters of an input string to uppercase at those given indices and print the resultant string. Input inputString = 'hello tutorialspoint python' indexList = [0, 6, 8, 10, 15, ... Read More
1 2 3 4 5 6 7 ... 3151 Next
Advertisements