- Trending Categories
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 9321 Articles for Object Oriented Programming
![Shriansh Kumar](https://www.tutorialspoint.com/assets/profiles/644826/profile/60_1575483-1682416785.jpg)
262 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)
484 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)
6K+ 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)
3K+ 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)
220 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)
177 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)
518 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
![Rudradev Das](https://www.tutorialspoint.com/assets/profiles/631515/profile/60_2136687-1680239346.jpg)
4K+ Views
In the field of computer science, the string is a collection of a continuous character data sets. Here in this particular problem we will use some spaces to execute the logic. The individual characters present here in the string can be accessed through its index to perform the code. Here is a general flow to build a logic code to separate the individual characters from a string in a Java environment. Define a string with characters. Print the individual characters present from a given string. Set an initial to zero. Print the string by using the function string.charAt(i). Iterate ... Read More
![Rudradev Das](https://www.tutorialspoint.com/assets/profiles/631515/profile/60_2136687-1680239346.jpg)
2K+ Views
Array is a collection of same data types stored at some contiguous memory locations. The arrays are a class present in java.until package which provides pre-defined sorting with a static manner and no return value. Here is the syntax of the Arrays.sort() method mentioned below − public static void sort(int[] ar, int from_index, int to_index) Here in the above syntax we have ar - short of the array name from_index - a parameter we can use as optional, where the sorting takes a run. to_index - an optional parameter donates the index of the element. Here is ... Read More