Found 34890 Articles for Programming

Java Program to Illustrates Use of Static Inner Class

Sakshi Ghosh
Updated on 11-Aug-2023 14:30:01
Here, we will demonstrate the usage of static inner class using the Java program. Before diving deep into the topic, let us get acquainted with the term Static Inner Class . Static Inner Class An inner class is the one, which is defined within another class. A Static Inner Class is a nested class that is a static member of the outer class. Other static members can be used to access it without first instantiating the outer class. A static nested class lacks access to the instance variables and methods of the outer class, much like static member’s java. Example ... Read More

Java Program to illustrate Total Marks and Percentage Calculation

Sakshi Ghosh
Updated on 11-Aug-2023 14:28:54
We will demonstrate how total marks and Percentages are calculated using Java programs. The term total marks refer to the summation of all the available marks, while the term percentage refers to the number obtained by dividing the calculated marks by total marks and multiplying the resultant by 100. percentage_of_marks = (obtained_marks/total_marks) × 100 Example 1 This is a Java program to demonstrate how total marks and percentages are calculated. // Java Program to demonstrate how is Total marks and Percentages calculated import java.io.*; public class TotalMarks_Percent1 { public static void main(String[] args){ int n = 8, t_marks ... Read More

Java Program to illustrate the Usage of Hexadecimal

Sakshi Ghosh
Updated on 11-Aug-2023 14:24:07
Here, the usage of Hexadecimal shall be demonstrated through the Java Program. Let us get acquainted with the term Hexadecimal before seeing a Java program. The Hexadecimal is a type of number system that has a base value of 16. There are 16 symbols representing hexadecimal numbers. These symbols or values are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. Each digit represents a decimal value.  The hexadecimal numbers from 0 to 9 are equivalent to decimal numbers from 0 to 9. Further, A represents 10, B represents 11, C represents ... Read More

Java Program to Illustrate the Availability of Default Constructor of the Super Class to the Sub Class by Default

Sakshi Ghosh
Updated on 11-Aug-2023 14:04:10
Here, we will demonstrate the availability of the default constructor of the super class to the sub class by default through Java Program. Before diving deep into the topic, let us get acquainted with the term Constructor, Super class, and subclass. Constructor A special method in Java is considered for the initialization of an object. The name of the constructor is the same as the class name and it does not return anything. A default constructor is invoked by itself whenever an object is created using a new keyword. There are following three types of constructors in Java ... Read More

Java Program to Illustrate Escaping Characters in Regex

Sakshi Ghosh
Updated on 11-Aug-2023 13:03:31
Here, we will demonstrate escaping characters in Regex through Java Program. Before diving deep into the topic, let us get acquainted with the term Escaping Characters and Regex. Regex It is an acronym for a Regular expression. It is an API that offers users to define String patterns that are useful for finding, modifying, and editing strings. A couple of areas of strings where Regex is frequently used to define the limitations include email validation and passwords. The java.util.regex package encompasses regular expressions. Escape character When a character is preceded by a backslash (\), it includes numbers, alphabets, and ... Read More

Handling PostgreSQL BLOB data in Python

Jaisshree
Updated on 10-Aug-2023 17:20:36
PostgreSQL is an open-source, object-relational database management system that offers diverse data types to save data.The BLOB (Binary large object) data kind is one instance of this. It is used to keep large binary records, such as audio, video, and photograph files. We should first set up the psycopg2 package, which offers a Python interface for PostgreSQL, so as to work with PostgreSQL in Python. The pip package manager is used to install it. Syntax pip install psycopg2-binary After the installation of the psycopg2 library, we need to connect to our PostgreSQL database with Python. The ... Read More

Get a list of a Particular Column Values of a Pandas Dataframe

Jaisshree
Updated on 10-Aug-2023 17:11:42
Pandas is a Python Library that is used to explore and clean the messy datasets, and make the data suitable for extracting necessary and valuable insights. Dataframe in Pandas is a two-dimensional data structure which is very much similar to spreadsheets, SQL tables, and Excel Datasheets. We can use various methods to extract the particular column values. Using '.values.tolist()' method Using '.loc[]' method Using '.iloc[]' method Using 'get()' function ... Read More

Generating Random Integers in Pandas Dataframe

Jaisshree
Updated on 10-Aug-2023 17:03:56
Generating random integers in a DataFrame using Python's Pandas library is an instrumental data analysis and manipulation technique. By developing and inserting random integers into a DataFrame, you open up a world of possibilities for various applications. This functionality proves particularly valuable in tasks like data simulation, algorithm testing, and generating synthetic datasets. Familiarizing yourself with this feature will undoubtedly enhance the flexibility and versatility of your data analysis workflows. Method 1: Using the randint() function from NumPy The randint() function found in the NumPy library is commonly utilized to generate random integers within a designated range, in ... Read More

Python script that is executed every 5 minutes

Mrudgandha Kulkarni
Updated on 10-Aug-2023 16:57:57
Automation and task scheduling play a crucial role in streamlining repetitive tasks in software development. Imagine having a Python script that needs to be executed every 5 minutes, such as fetching data from an API, performing data processing, or sending regular updates. Manually running the script at such frequent intervals can be time-consuming and prone to errors. That's where task scheduling comes in. In this blog post, we will explore how to schedule the execution of a Python script every 5 minutes, ensuring that it runs automatically without requiring manual intervention. We will discuss different approaches and libraries that can ... Read More

Python requests - POST request with headers and body

Mrudgandha Kulkarni
Updated on 10-Aug-2023 16:56:36
Python's requests library is a powerful tool for making HTTP requests in a simple and efficient manner. It provides an easy-to-use interface for sending GET, POST, and other types of requests to web servers. When it comes to making a POST request, it's often necessary to include headers and a request body, which contain additional information and data for the server to process. In this article, we will explore how to use the requests library to make a POST request with headers and a body. We will cover the fundamental concepts of headers and request bodies, demonstrate their usage in ... Read More
1 2 3 4 5 ... 3489 Next
Advertisements