Found 33676 Articles for Programming

Java Program to Allocate and Initialize Super Class Members using Constructor

Shriansh Kumar
Updated on 06-Jun-2025 13:57:24

484 Views

In Java, super refers to the parent class instance, and to inherit members of the super class to the child class, we use the extends keyword. Before writing a Java program to allocate and initialize super class members using a constructor, let's go through some concepts we are going to use in this article. What is Constructor? A Java constructor is a class member that initializes instance variables of a class. It is very similar to a method, but the difference is that methods can return a value, but a constructor does not return any value because it can't have any return ... Read More

Java Program to Add two Numbers without using Arithmetic Operator

Shriansh Kumar
Updated on 19-Jun-2025 15:46:18

4K+ Views

Arithmetic operators such as "+", "-", "*", and "/" are used to perform mathematical operations like addition, subtraction, multiplication, modulo, and division. We have added two numbers using the "+" operator, but in this article, we are going to learn a few Java programs that can add two numbers without using arithmetic operators. The following operators best serve this purpose: Increment operators (++) Bitwise operators ... Read More

Java Program to Calculate Interest for FDs and RDs using Inheritance

Shriansh Kumar
Updated on 06-Jun-2025 14:04:57

872 Views

Inheritance is a concept that allows us to access the properties and behaviors of one class in another class. The class whose methods and member variables are inherited is known as the super class or parent class, and the class that inherits these methods and member variables is known as the child class or subclass. In Java, we use the extends keyword to inherit a class. Problem Statement Write Java programs that calculate interest for Fixed Deposits (FDs) and Recurring Deposits (RDs) using inheritance. The program should prompt the user to choose between FD and RD, enter the amount and duration, ... Read More

Java Program to Calculate difference between two Time Periods

Shriansh Kumar
Updated on 19-Jun-2025 10:19:22

824 Views

We are given two time periods, and our task is to write a Java program to calculate the difference between them. For this problem, we can use classes and methods of java.time, java.util, and java.text packages. SimpleDateFormat class Date class LocalDate class Period class parse() method between() method As we move further in this article, we will understand the uses of these classes and methods in calculating the difference between two time periods. Some examples ... Read More

Java Program to Calculate Sum of Two Byte Values Using Type Casting

Shriansh Kumar
Updated on 19-Jun-2025 15:38:06

526 Views

When we convert a data type to another data type, we call it type casting. There are two types of type casting in Java: explicit and implicit. Explicit Type Casting  When we typecast a one datatype to another using the cast operator "()",  it is known as explicit type casting, and it is done manually. We typically use the cast operator to convert a higher datatype to a lower datatype. Therefore, there is a risk of losing data because a lower datatype has a range smaller than a higher datatype. Implicit Type Casting But, to convert a smaller datatype to a larger one, ... Read More

Java Program to Categorize Taller, Dwarf and Average by Height of a Person

Shriansh Kumar
Updated on 30-May-2025 16:22:30

499 Views

The given task is to categorize Taller, Dwarf, and Average by the Height of a Person. First of all, we need to define tall, dwarf, and average height of a person. Let us assume -A person with a height between 170cm to 195cm is considered taller.If his height is between 150cm and 195cm, he is considered taller.A person whose height is below 150cm is considered a dwarf.If his height is greater than 195cm, he is considered abnormal.Categorizing the Height of a Person in JavaTo categorize the Height of a Person, we need to compare his height with each range specified above. ... Read More

Java Program to Add Characters to a String

Shriansh Kumar
Updated on 30-May-2025 17:54:49

13K+ Views

Java Program to Add Characters to a String Java provides different ways to add characters to a string. We can add characters in the beginning or at the end or at any position according to the need. In this article, we are going to see three different approaches to do so: Using '+' operator Using methods of StringBuffer and StringBuilder classes ... Read More

Create XML Documents using Python

Tamoghna Das
Updated on 25-Apr-2023 17:24:11

27K+ Views

What are the requirements of XML Documents? XML documents are used extensively in the process of data communication between various computer systems. Python comes with a number of built-in libraries that may be used for the processing and manipulation of XML files. In this piece, we will investigate the use of Python in the process of generating XML documents. First, we will look at a simple illustration, and then we will go to more complex illustrations. Prerequisites Python 3.0 An understanding of XML syntax Steps and processes Step 1: Creating a basic XML document To create an XML ... Read More

Create web element driver method in selenium Python

Tamoghna Das
Updated on 25-Apr-2023 17:18:50

1K+ Views

What is Selenium? One of the most well-known open-source frameworks for automating web browsers is called Selenium. It enables developers and testers to simulate user actions on a web page, such as clicking buttons, filling out forms, and navigating between pages, in order to test web applications or carry out repetitive tasks. For example, this could include clicking "Submit" on a form, clicking "Next" on a page, and so on. There are a number of programming languages that may be used with Selenium, including Python, Java, C#, and JavaScript. In addition to that, it gives users access to a variety ... Read More

Create View Class Based Views Django

Tamoghna Das
Updated on 25-Apr-2023 17:16:53

784 Views

What is Django? Django is a well-known web framework written in Python that enables developers to create web applications more quickly. The views in a Django application are the ones in charge of processing HTTP requests and sending back HTTP answers. Class-based views, also known as CBVs, are an alternative to function-based views, also known as FBVs. They provide a method to designing views that is more object-oriented. Python classes that inherit from one of Django's built-in view classes are what are referred to as CBVs in the Django framework. These classes provide methods that correlate to the various HTTP ... Read More

Advertisements