In Java, both abstract and final are class modifiers but they are completely opposite to each other. That's why Java class cannot be both abstract and final. Abstract class An abstract class in Java is a class that may contain both abstract methods (without implementation) and concrete methods (with implementation). If a class has even one abstract method, it must be declared abstract. You cannot create objects of an abstract class directly. If you want to use the concrete method in an abstract class you need to inherit the class, provide implementation to the abstract methods (if any) and ... Read More
Namespace packages is a special package introduced in Python 3.3 that allows you to split package contents across multiple directories. If you didn't include at least an empty _init_.py file in your package, then your package becomes a namespace package. In Python, a namespace package allows you to spread Python code among several projects. This is useful when you want to release related libraries as separate downloads. Currently, there are three methods for developing namespace packages. These methods are mentioned below. Native namespace packages (PEP 420) pkgutil-style Namespace packages ... Read More
When we are working with those Java applications that handle JSON data, it is common that we find different date formats. It might happen that one field contains just the date, while another includes time and date, and even time zone. For handling this type of data Jackson library is very helpful. Jackson is a popular Java library that is used to convert Java objects into JSON and vice versa. And this process is called serialization and deserialization. To handle multiple date formats in a single class, Jackson provides an annotation called @JsonFormat. The@JsonFormat The @JsonFormat annotation helps Jackson ... Read More
What are Namespace Packages? Namespace packages are a type of package in Python that allows you to split the sub-packages and modules within a single package across multiple, separate distribution packages. Unlike normal packages, the namespace packages don't require _init_.py file. Automatically importing all submodules within a namespace package serves several purposes, like auto-registration without manually importing, and to load all available plugins in a system. This article discusses the two methods that you can use to import all the sub-modules of a Python namespace package - Using pkgutil.iter_modules() Using ... Read More
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
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP