
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

491 Views
A circular reference occurs if two separate objects pass references to each other.In older browsers circular references were a cause of memory leaks. With improvements in Garbage collection algorithms, which can now handle cycles and cyclic dependencies fine, this is no longer an issue.However, from a pure design point of view, circular referencing is still a bad thing and a code smell. Circular referencing implies that the 2 objects referencing each other are tightly coupled and changes to one object may need changes in other as well.Avoiding circular referencesThere is no one way to avoid circular reference in JS. It ... Read More

1K+ Views
A circular reference occurs if two separate objects pass references to each other.In older browsers circular references were a cause of memory leaks. With improvements in Garbage collection algorithms, which can now handle cycles and cyclic dependencies fine, this is no longer an issue.However, from a pure design point of view, circular referencing is still a bad thing and a code smell. Circular referencing implies that the 2 objects referencing each other are tightly coupled and changes to one object may need changes in other as well.Avoiding circular referencesThere is no one way to avoid circular reference in JS. It ... Read More

2K+ Views
Memory management in JavaScript is much easier than in low-level languages like C or C++. Unlike low-level languages, JavaScript automatically detects which objects will be needed in later cases and which will be garbage that is occupying memory without any reason. In this article, we shall discuss how garbage collection (GC) works in JavaScript. There are a few important parts that we are going to discuss in detail− Reachability from root Interlinked Objects (interconnections between different objects) Unreachable Collections (Broken link) Reachability The first concept of memory management is reachability. In this mode, the garbage collector tries to ... Read More

2K+ Views
The JSON is one of the widely used data-interchange formats and is a lightweight and language independent. The json.simple is a lightweight JSON processing library that can be used to write JSON files and it can be used to encode or decode JSON text and fully compliant with JSON specification(RFC4627). In order to read a JSON file, we need to download the json-simple.jar file and set the path to execute it.Exampleimport java.io.*; import java.util.*; import org.json.simple.*; import org.json.simple.parser.*; public class JSONObjectWriterToFileTest { public static void main(String[] args) throws IOException { JSONObject obj = new JSONObject(); obj.put("Name", "Adithya"); ... Read More

19K+ Views
The JSON is a text-based format for exchanging data. It is a lightweight component and language independent. We can also add a JSONArray to JSONObject. We need to add a few items to an ArrayList first and pass this list to the put() method of JSONArray class and finally add this array to JSONObject using the put() method. Exampleimport org.json.*; import java.util.*; public class AddJSONArrayToJSONObjTest { public static void main(String args[]) { List list = new ArrayList(); list.add("Raja"); list.add("Jai"); list.add("Adithya"); JSONArray array = new JSONArray(); for(int i = 0; i < list.size(); ... Read More

61K+ Views
The JSON is one of the widely used data-interchange formats and is a lightweight and language independent. The json.simple is a lightweight JSON processing library that can be used to read and write JSON files and it can be used to encode or decode JSON text and fully compliant with JSON specification (RFC4627). In order to read a JSON file, we need to download the json-simple.jar file and set the path to execute it.json fileExampleimport java.io.*; import java.util.*; import org.json.simple.*; import org.json.simple.parser.*; public class JSONReadFromTheFileTest { public static void main(String[] args) { JSONParser parser = new JSONParser(); try { ... Read More

16K+ Views
In Java, ArrayList and HashSet are the most important classes of the Collection Framework. Both are used to "store collections of elements", but they are used for different purposes and have different characteristics. ArrayList is an "ordered collection" that allows duplicate elements, while HashSet is an "unordered collection" that does not allow duplicates. ArrayList vs HashSet in Java Here are some key differences between ArrayList and HashSet in Java: Key ArrayList HashSet Implementation ArrayList is the implementation of the List interface. HashSet, on the other hand, is the implementation of a set interface. ... Read More

6K+ Views
In Java, both Applets and Servlets are the programs or applications that run in a Java environment. Applets are designed to provide interactive features that can be embedded into web pages and allow users to engage with content directly through their web browsers. On the other hand, Servlets operate on the server side, they handle requests and responses, which is most important for generating dynamic content in web applications. The main difference in both programs is that their processing is done in different environments. Difference between Applets and Servlets Some of the major differences between Applets and Servlets are as ... Read More

1K+ Views
Java provided these two interfaces to traverse the data one by one stored in a collection. The internal implementation of iterator and list iterator makes them differ apart but the main agenda of both the iterators is the same.The following are the important differences between Iterator and ListIterator.Sr. No.KeyIteratorListIterator1ApplicableIterator can be used to traverse any collection irrespective of the type of collection.List iterator can only be used to iterate only List collection implemented classes like arraylist, linkedlist etc.2CallingAs mentioned Iterator must be used to enumerate elements in all Collections implemented interfaces like Set, List, Queue, Deque and also in all ... Read More

12K+ Views
A Java both int and Integer are used to store integer type data the major difference between both is type of int is primitive while Integer is of class type.This difference become significant when concept of OOPs comes in picture during development as int follows the principle of primitive data type while Integer behave as a wrapper class.Following are the important differences between int and Integer.Sr. No.KeyintInteger1TypeA int is a data type that stores 32 bit signed two's compliment integer.On other hand Integer is a wrapper class which wraps a primitive type int into an object.2Purposeint helps in storing integer ... Read More