Found 9150 Articles for Object Oriented Programming

Difference between a Static Queue and a Singly Linked List in Java.

Nitin Sharma
Updated on 16-Sep-2019 11:10:29

864 Views

In Java List and Queue both are introduced as an ordered list of objects, where the same object may be added more than once. The difference between both comes in the manner of adding elements. In the queue, all the elements get inserted at the rear and removed from the front while we can add an element anywhere in the list.Sr. No.KeyStatic QueueSingly Linked List1Data initialization.Static Queue works in first out(FIFO) fashion as all the elements get inserted at the REAR and removed from the FRONT of the queue.In the case of Singly Linked List, one can add elements anywhere ... Read More

Memory Management in JavaScript

Arnab Chakraborty
Updated on 22-Aug-2022 12:59:07

1K+ Views

Memory management is an essential task when writing a good and effective program in some programming languages. This article will help you to understand different concepts of memory management in JavaScript. In low-level languages like C and C++, programmers should care about the usage of memory in some manual fashion. On the other hand, Javascript automatically allocates memory when objects are created into the environment and also it cleans the memory when an object is destroyed. JavaScript can manage all of these on its own but this does not imply that the developers do not need to worry about the ... Read More

How can we convert a JSON string to a JSON object in Java?

raja
Updated on 03-Jul-2020 14:06:49

6K+ Views

The JSON stands for JavaScript Object Notation and it can be used to transfer and storage of data.  The JSONObject can parse text from a String to produce a map-like object. The object provides methods for manipulating its contents, and for producing a JSON compliant object serialization. The JSONArray can parse text from a String to produce a vector-like object. The object provides methods for manipulating its contents, and for producing a JSON compliant array serialization.In the below two examples, We can convert a JSON string to a JSON object.Example 1import org.json.JSONObject; import org.json.JSONArray; public class StringToJSONTest {    public static void main(String args[]) {   ... Read More

What is the use of .clear() method in Javascript weakMap?

Abdul Rawoof
Updated on 26-Aug-2022 11:58:18

560 Views

WeakMap is a collection in JavaScript. This type of collection is used to store the data in the form of key-value pairs. In WeakMap, the key must be definitely an object and the values can be of any type. This collection is called as WeakMap because of the key which is mandated to be the object. An object can be garbage collected which is a disadvantage when compared with Map. In JavaScript WeakMap, clear() function is used to delete the whole weakMap or removes all the elements in the weakMap. Syntax the syntax for weak map is as follows. mapName.clear() ... Read More

Name some methods of weakMap instances in javascript?

Abdul Rawoof
Updated on 26-Aug-2022 11:58:00

127 Views

WeakMap is a collection in JavaScript. This type of collection is used to store the data in the form of key-value pairs. In WeakMap, the key must be definitely an object and the values can be of any type. New function in weakMaps A new WeakMap is created using the ‘new’ key word dynamically. Syntax A new WeakMap is created using the syntax mentioned below. var weakMapName = new WeakMap() Example 1 This example demonstrates how to create a WeakMap using new operator in JavaScript − var wkMap = new WeakMap() if(wkMap){ console.log("WeakMap is created using ... Read More

Why do we need weakMaps in Javascript?

Abdul Rawoof
Updated on 26-Aug-2022 11:57:42

431 Views

WeakMap is a collection in JavaScript. This type of collection is used to store the data in the form of key-value pairs. In WeakMap, the key must definitely be an object and the values can be of any type. The difference between a Map and a WeakMap is, in weakmap key must be an object and the other difference is that a weakmap is like a blackbox where the keys can’t be retrieved. The value of the weakmap can be accessed only if the key is known which means the values in the weakmap are private. Additional data can be ... Read More

Differences between web-garden and a web-farm in Javascript

Ayush Gupta
Updated on 16-Sep-2019 08:52:25

418 Views

Web Garden is the web hosting system which comprises of multiple “processes”. This means that we have a single server on which we run multiple processes. This type of hosting provides logical scalability to our web applications.Web Farm is the web hosting system which comprises of multiple “computers”. This is different from web-garden as web garden runs on a single server while a web farm runs across multiple servers. This provides physical scalability to out web applications. This type of set up is achieved using Load balancers to balance calls coming to the server using a dedicated process that forwards ... Read More

How to enable a strict mode in javascript?

Arnab Chakraborty
Updated on 04-Apr-2023 11:37:42

168 Views

In JavaScript, there are two different programming paradigms. The sloppy mode, sometimes referred to as the simple mode, is activated by default. We don't have to write the code strictly according to guidelines in this manner. On the other side, there is also the stringent mode. This setting allows the environment to have some rigid constraints. Strict mode has different meanings than regular code and is not a subset of sloppy mode. This article will explain how to enable strict mode in JavaScript and will also go over some of the features of "Strict" Mode. Syntax Different scopes can allow ... Read More

What are the characteristics of JavaScript 'Strict Mode'?

Arnab Chakraborty
Updated on 22-Aug-2022 12:32:00

446 Views

This tutorial will explain you what are the different characteristics of JavaScript 'Strict Mode'. As such, there are two different modes of programming in JavaScript. By default, the simple mode or sometimes known as the sloppy mode is enabled. In this mode, we do not need to follow strict rules while writing the code. On the other hand, the strict mode is also there. This mode enables some strict rules in the environment. Strict mode is not a subset of the sloppy mode but it also has different semantics than normal code. Syntax Strict modes can be ... Read More

How to find operating system in the client machine using JavaScript?

Abdul Rawoof
Updated on 26-Aug-2022 11:58:35

1K+ Views

The type of operating system used in the client machine can be detected using some of the functions in JavaScript. The different functions are discussed below. Using navigator.appVersion This property will return the information about the browser and the operating system being used in the form of a string. Syntax The syntax for the navigator.appVersion is given below. navigator.appVersion Example 1 This example demonstrates the usage of navigator.appVersion to detect client OS − Click to get the operating system Operating System ... Read More

Advertisements