![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
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
528 Views
To count occurence of vowels in a string again use Map utility of java as used in calculating occurence of each character in string.Put each vowel as key in Map and put initial value as 1 for each key.Now compare each character with key of map if a character matches with a key then increase its corresponding value by 1.Examplepublic class OccurenceVowel { public static void main(String[] args) { String str = "AEAIOG"; LinkedHashMap hMap = new LinkedHashMap(); hMap.put('A', 0); hMap.put('E', 0); hMap.put('I', 0); hMap.put('O', 0); hMap.put('U', 0); for (int i = 0; i
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
28K+ Views
In this post we will try to print an array or matrix of numbers at console in same manner as we generally write on paper.For this the logic is to access each element of array one by one and make them print separated by a space and when row get to end in matrix then we will also change the row.Example Live Demopublic class Print2DArray { public static void main(String[] args) { final int[][] matrix = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; for (int i = 0; i
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
1K+ Views
In Java Immutable class is a class which once created and it's contents can not be changed.On same concept Immutable objects are the objects whose state can not be changed once constructed.Wrapper classes are made to be immutable due to following advantages −Since the state of the immutable objects can not be changed once they are created they are automatically synchronized.Immutable objects are automatically thread-safe, the overhead caused due to use of synchronisation is avoided.Once created the state of the wrapper class immutable object can not be changed so there is no possibility of them getting into an inconsistent state.The ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
4K+ Views
As we know that in Java POJO refers to the Plain old Java object.POJO and Bean class in Java shares some common features which are as follows −Both classes must be public i.e accessible to all.Properties or variables defined in both classes must be private i.e. can't be accessed directly.Both classes must have default constructor i.e no argument constructor.Public Getter and Setter must be present in both the classes in order to access the variables/properties.The only difference between both the classes is Java make java beans objects serialized so that the state of a bean class could be preserved in ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
351 Views
POJI is an acronym for Plain Old Java Interface which corresponds to a Java standard interface which means that these interfaces are in the context of providing services in JEE. For example, OSGI service is offered through POJI in JEEIn other terms we can say that POJI is an ordinary interface without any specialty that is not inherited from any of the technology API specific interfaces or framework interfaces.Exampleinterface myCustomInterface { public void myMethod(); } interface mySecondCustomInterface extends myCustomInterface { public void mySecondMethod(); }Both interfaces would be called as POJI as they do not inherit any technology specific ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
4K+ Views
As we know it is core concept that in Java there is always pass by value and not by pass by reference.So in this post we will focus on that how this concept get validated in case of passing primitive and passing reference to a method.In case when a primitive type is passed to a method as argument then the value assigned to this primitive is get passed to the method and that value becomes local to that method, which means that any change to that value by the method would not change the value of primitive that you have ... Read More
![Rudradev Das](https://www.tutorialspoint.com/assets/profiles/631515/profile/60_2136687-1680239346.jpg)
638 Views
The constructor chaining is a particular sequence of injecting constructors when an user initialize an object in a particular method. This process can be used when we invoke a bulk number of constructors one by one only on the basis of the instance class. This process is an another method linked with the inheritance where the task of a sub-class constructor to call a super class constructor. Constructor chaining can be performed in two ways in Java − Within same class − The process can be done by the using of this() keyword for the constructors present in the same class. From base class − by using the ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
3K+ Views
There are five main memory areas which are used to various Java elements. Following is the list of the same. Class Area - This area contains the static members of the class. Method Area - This area contains the method definition and executable code. Heap Area - This area contains the objects which are dynamically allocated/deallocated. if an object is no more referenced by any live reference it is deallocated. Stack Area - This area contains the local variables. Pool Area - Contains immutable objects like string.
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
5K+ Views
The volatile modifier is used to let the JVM know that a thread accessing the variable must always merge its own private copy of the variable with the master copy in the memory.Accessing a volatile variable synchronizes all the cached copied of the variables in the main memory. Volatile can only be applied to instance variables, which are of type object or private. A volatile object reference can be null.Examplepublic class MyRunnable implements Runnable { private volatile boolean active; public void run() { active = true; while (active) { } } public void stop() { active = false; } }
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
2K+ Views
When we start two or more threads within a program, there may be a situation when multiple threads try to access the same resource and finally they can produce unforeseen result due to concurrency issues. For example, if multiple threads try to write within a same file then they may corrupt the data because one of the threads can override data or while one thread is opening the same file at the same time another thread might be closing the same file.So there is a need to synchronize the action of multiple threads and make sure that only one thread ... Read More