
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 9150 Articles for Object Oriented Programming

299 Views
The sum of the nth squares series is a form of arithmetic progression where the sum of squares is arranged in a sequence with the initial term as 1, and n being the total number of terms. 12 + 22 + 32 + ... + n2 In this article, we will discuss a Java program to add the nth square series. But, before that, let's see an example scenario: Example Scenario: Input: num = 6 Output: sum = 91 It will be calculated as: 12 + 22 + 32 + 42 + 52 + 62 = 1 ... Read More

485 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

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

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

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

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

4K+ Views
In mathematics, the divisibility rule of 5 states that if the number ends with 0 or 5 then it will divisible by 5. There is another way to identify the divisibility rule of 5, if the remainder comes to 0 it returns the number is divisible by 5. The mod(%) operator is normally used in programming when it comes to divisibility. Following are some examples which helps you to understand the divibility rule of 5 − Given number is 525, the number ends with 5 and it is divisible by 5. Given number is 7050, the number ends with ... Read More

337 Views
In this article, we will learn about constructors in Java. Constructors initialize objects when they are created. We will also see how the parent constructor is called in inheritance. Problem StatementWe will demonstrate possible approaches to show how the inherited constructor calls the parent constructor by default.Different approaches The following are the different approaches to show how the inherited constructor calls the parent constructor by default− Demonstrating inheritance properties ... Read More

265 Views
In this article, we will explore the use of access modifiers in Java by demonstrating their functionality in different scenarios. Access Modifiers Access modifiers are used to set the feature of visibility of some particular classes, interfaces, variables, methods, constructors, data members, and the setter methods in Java programming language. In a Java environment, we have different types of access modifiers. Default - If we declare a function, it will be visible only within a particular package. ... Read More

723 Views
The Java heap is a particular memory area which is used to store the objects and represent them as or by an instance in Java Virtual Machine. The Java heap can be shared between two threads as long as the environment is occupied by some running applications. The heaps are sorted in a stack memory and follow the Last In First Out (LIFO) method after the creation of an object in JVM. When the size of the heap memory is compared to the stack, the spare objects are cleared by the GarbageCollector automatically. The heap memory is divided into three ... Read More