![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 9326 Articles for Object Oriented Programming
![Shriansh Kumar](https://www.tutorialspoint.com/assets/profiles/644826/profile/60_1575483-1682416785.jpg)
124 Views
Sum of nth squares series is a form of arithmetic progression where sum of squares is arranged in a sequence with initial term as 1, and n being the total number of terms. 12 + 22 + 32 + ….. + n2 In this article, we will discuss java program to add the nth square series. Approach 1: Using Iterative approach Let’s understand the logic for program with a simple example. Example If we take input as num = 6 It will be calculated as: 12 + 22 + 32 + 42 + 52 + 62 = ... Read More
![Shriansh Kumar](https://www.tutorialspoint.com/assets/profiles/644826/profile/60_1575483-1682416785.jpg)
258 Views
In java, super refers to the parent class and to inherit one class to another class we use extends keyword. Before making a java program to allocate and initialize super class members using constructor, let’s go through some concepts we are going to use in this article. What is Constructor? Constructor is very similar to methods but the difference is that methods define the behavior of an object but constructor is used to initializing those objects. We can provide any name of our choice to methods but a constructor must have same name as class name. Also, methods ... Read More
![Shriansh Kumar](https://www.tutorialspoint.com/assets/profiles/644826/profile/60_1575483-1682416785.jpg)
2K+ Views
Arithmetic operators such as +, -, *, / are used to perform mathematical operations like addition, subtraction, multiplication, modulo and division. We all have done addition of two numbers using + operator but in this article, we are going to see a few java programs that can add two numbers without using arithmetic operators. The following operators best serve this purpose − Increment operators (++) − They are used to increment value of a variable by 1. It is of two types pre increment and post increment. Pre increment operator first increases the value and then, uses it for ... Read More
![Shriansh Kumar](https://www.tutorialspoint.com/assets/profiles/644826/profile/60_1575483-1682416785.jpg)
584 Views
Inheritance is a concept that allows us to access the properties and behaviors of one class to another class. The class whose methods and member variables are inherited is known as super class or parent class and the class that inherits these methods and member variables is known as child class or sub class. In java, we use ‘extends’ keyword to inherit a class. In this article, we will discuss a java program to calculate interest for FDs and RDs using Inheritance. First, create these four java files in your local machine ide − Acnt.java − This file will ... Read More
![Shriansh Kumar](https://www.tutorialspoint.com/assets/profiles/644826/profile/60_1575483-1682416785.jpg)
473 Views
To work with date and time in java, we need to import java.time, java.util and java.text packages. We are going to use the following classes and methods provided by these packages to calculate difference between two time periods in java − 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. Approach 1: Using SimpleDateFormat and Date class SimpleDateFormat − It is a class in java that allows us to convert date to string (formatting) and convert string to ... Read More
![Shriansh Kumar](https://www.tutorialspoint.com/assets/profiles/644826/profile/60_1575483-1682416785.jpg)
5K+ Views
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 approaches to do so − Using ‘+’ operator Using methods of StringBuffer and StringBuilder class Using substring() method Approach 1: Using ‘+’ Operator In this section, we will add a character to a string using the concatenation operator. Example public class Main { public static void main(String[] args) { String ... Read More
![Tapas Kumar Ghosh](https://www.tutorialspoint.com/assets/profiles/641996/profile/60_877006-1681905500.jpg)
2K+ 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. Let’s take an example of this. Given number is 525, the number ends with 5 and it is divisible by 5. Given number is 7050, the number ends with 0 and it is divisible by 5. Given number ... Read More
![Rudradev Das](https://www.tutorialspoint.com/assets/profiles/631515/profile/60_2136687-1680239346.jpg)
217 Views
What are the constructors? Constructors are used to initialize the values of a particular object. The default constructor is a constructor which has no parameters. These constructors are used to create objects, which don't have any specific value as the initial. In java, there is a keyword super(). This method is widely used in Java environment when the inheritance applied on a Java code. This super() class is used to call to the constructor of the parent class. The parent class must contain two public constructors which takes two int parameters. As we know the constructors cannot be inherited in ... Read More
![Rudradev Das](https://www.tutorialspoint.com/assets/profiles/631515/profile/60_2136687-1680239346.jpg)
176 Views
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 visible only within a particular package. Private - If we declare a function, it will visible only within a particular class only. Protected- If we declare a function, it will visible only within a particular package or for all sub classes. Public - If we declare a function, it will visible ... Read More
![Rudradev Das](https://www.tutorialspoint.com/assets/profiles/631515/profile/60_2136687-1680239346.jpg)
508 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 a heap memory is compared to stack, the spare objects are cleared by the GarbageCollector automatically. The heap memory are divided into three parts ... Read More