Method overloading helps to create multiple methods with the same name to perform similar operations in different ways ( using different types of parameters). Automatic Type promotion or conversion in Java is a process in which the compiler automatically promotes a small-sized data type to a larger-sized data type. It is not possible to convert a larger size to a smaller size automatically. In method overloading, the overloaded method is called based on the arguments passed. Suppose we are calling an overloaded method, and the type of argument is not the exact match to the type defined in the method ... Read More
In Python, strings and bytes are two different types of data, Where the strings are the sequences of unicode characters used for text representation, While bytes are sequences of bytes used for binary data. Converting strings to bytes is used when we want to work with the raw binary data or perform low-level operations. This can be done by using the built-in encode method. Using Python encode() Method The Python encode() Method is used to convert the string into bytes object using the specified encoding format. Syntax Following is the syntax for Python encode() method ... Read More
While working with the strings, Checking if the string exists inside another string is a common task and can be achieved by using the in keyword. But, In this article we are going to see how to check if multiple strings exist in another string in Python. For example, checking the multiple strings: "TP", "WELCOME", exists in the string "WELCOME to TP". For achieving this, Python provides different methods including loops, any() and all(). Using Python any() Function The Python any() function returns true if any of the element of the given iterable (such as list, ... Read More
The strings are the fundamental data types that are used to store text. When working with the string, Checking if the string is empty or not is a common task. An empty string is nothing but the string with zero characters. There are various to check if a sting is empty, But choosing the elegant ways helps to improve the code readability. Let's dive into the article to learn more about it. Using if not my_string In Python, empty strings are considered as falsy, Which evaluates to false in a boolean content. So using not my_string returns true ... Read More
The Lists in Python are used to store collections of items such as numbers, strings. While working with the list of strings, it is common to find a empty strings in the list. An empty string is nothing but a string value with zero length. Officially they are present as elements in the list, but does not hold any data and interfere in the operations like sorting, filtering. So, removing the empty strings is essential to ensure the list contains only valid values. For achieving this, Python provides the several ways. Let's dive into the article to learn ... Read More
The escape sequences are the special characters that are used to represent the whitespace characters, quotes, backslashes or non-printable characters within the string. These sequences start with the backslash followed by the character, For example result in newline. However, in some cases we will come across the situations to process or even to ignore these situations. In this article we will learn how to process the escape sequences. Example Let's look at the following example, where we are going to consider the basic approach to process the escape sequences. str1 = "Hello\tEveryoneWelcome to TutorialsPoint" print(str1) ... Read More
Python regular expressions (regex) provide various ways to handle whitespaces, including spaces, tabs, and newline characters, which can be effectively stripped from strings using regex. This article will explain how to split a string on newline characters using different regular expressions, following are the various methods to achieve the present task. Using re.split(r"[]", text) Splitting on One or More Newlines Using Quantifier [+] Splitting on Newlines with Whitespace Using re.split(r"\s*", text) Using re.split(r"[]", text) The re.split() function splits a string wherever the specified regular expression pattern ... Read More
A JAR file is like a ZIP file but for Java code. For the packaging of multiple class files, Java provides a file format known as JAR (Java Archive). Typically, a JAR file contains .class files, images, text files, and libraries in a single file that are required to execute the Java application or library. This file format is used to distribute application software and libraries in Java. All the predefined libraries are available in this format. If you have any library in JAR format, to use it in your application, you either need to place it in the current folder ... Read More
If you’ve been coding in Java for some time, you might have wondered why you can't make an enum extend another class. It seems like it should, but Java won't let you. Let's break down why this happens Enumeration in Java Enumeration (enum) in Java is a user-defined datatype which stores a set of constant values. You can use enumerations to store fixed values such as days in a week, months in a year, and seasons, etc. If we had to store all seven days of a week into one single variable then we might tend to use data ... Read More
The interpolation search is an improved version of the binary search. The list is divided using the mid element in the binary search whereas the interpolation search algorithm tries to locate the exact position using the interpolation formula. For this algorithm to work properly, the data collection should be in a sorted form and equally distributed. In this article, we have a sorted array. Our task is to implement the interpolation search algorithm algorithm on this sorted array in C++. The formula used in this algorithm to find the position is given below: Interpolation Position Search Formula pos = ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP