Found 34484 Articles for Programming

getParameter() - Passing data from client to JSP

Shriansh Kumar
Updated on 21-Jul-2023 22:04:59

478 Views

JSP stands for Java Server Pages and is used for the purpose of developing web based applications. A single JSP page consists of HTML tags for static content and JSP tags to construct dynamic content. The JSP tags start with ‘’. We save our JSP file with the extension ‘.jsp’. The getParameter() method of JSP takes an argument and retrieves data associated with it from the source and further pass it to the destination. The source could be an HTML or JSP page and the destination could be another JSP page. Syntax request.getParameter("source"); Steps of Passing data from client ... Read More

Plotting A Square Wave Using Matplotlib, Numpy And Scipy

Shriansh Kumar
Updated on 21-Jul-2023 18:45:53

892 Views

A square wave is a type of non-sinusoidal waveform that is widely used in electric and digital circuits to show signals. Basically, these circuits use a square wave to represent input and output or on and off. Python provides several ways to plot square waves including Matplotlib, NumPy and Scipy libraries. These libraries offer various built-in methods for data visualization, making it easy to create and customize square wave plots. Python Program for plotting a Square Wave Before discussing the example programs, it is necessary to familiarize ourselves with the basics of Matplotlib, NumPy and Scipy libraries. ... Read More

Plot Line Graph from NumPy Array

Shriansh Kumar
Updated on 25-Jul-2023 10:43:34

2K+ Views

A line graph is a common way to display the relationship between two dependent datasets. Its general purpose is to show change over time. To plot a line graph from the numpy array, we can use matplotlib which is the oldest and most widely used Python library for plotting. Also, it can be easily integrated with numpy which makes it easy to create line graphs to represent trends and patterns in the given datasets. Python Program to Plot line graph from NumPy array Here are the example programs that demonstrate how to plot line graphs from numpy ... Read More

Getting Set View of Keys from HashMap in Java

Shriansh Kumar
Updated on 21-Jul-2023 20:39:59

274 Views

To get the set view of keys from a HashMap in Java, we can use the in-built method named ‘keySet()’. Here, the HashMap is a class that is used to implement Map Interface. It stores its element in key-value pairs. The Key is an object that is used to fetch and receive value associated with it. It has access to all the methods of Map Interface, it does not have any additional methods of its own. Duplicate values are not allowed, although we can store null values and keys. Java Program to Get Set View of Keys from HashMap keySet() ... Read More

Getting Synchronized Map from Java HashMap

Shriansh Kumar
Updated on 21-Jul-2023 20:32:34

2K+ Views

To get the synchronized Map from a Hash Map in Java, we can use an in-built method of Collection interface named ‘synchronized Map()’. Here, the Hash Map is a class that is used to implement Map Interface. It stores its element in key-value pairs. The Key is an object that is used to fetch and receive value associated with it. It has access to all the methods of Map Interface, it does not have any additional methods of its own. Duplicate values are not allowed, although we can store null values and keys. In this article, we will explore the ... Read More

Getting Synchronized Map from Java TreeMap

Shriansh Kumar
Updated on 21-Jul-2023 20:28:31

251 Views

To get the synchronized Map from a TreeMap in Java, we can use an in-built method of Collection interface called ‘synchronizedMap()’. Here, TreeMap is a class that is used to implement NavigableMap Interface. It stores the elements of the map in a tree structure. It provides an efficient alternative to store the key-value pairs in sorted order. By default, a TreeMap is not synchronized. In this article, we will explain the need for synchronization and its practical implementation through example programs. Synchronized Map from a Tree Map A Tree Map is not thread-safe which means when we implement it in ... Read More

Reverse String according to the number of words

Way2Class
Updated on 21-Jul-2023 17:58:41

154 Views

String manipulation is an essential skill in programming, as it helps us process and analyze text data efficiently. C++ provides a rich set of string manipulation functions and objects, making it easier to work with text data. In this article, we will discuss how to reverse a string according to the number of words in C++. Approaches Approach 1 − Using stringstreams and vectors Approach 2 − Using substrings and string manipulation functions Syntax String object in C++: The std::string class is a part of the C++ Standard Library and provides various string manipulation functions. String manipulation functions: ... Read More

How Objects Can an ArrayList Hold in Java?

Shriansh Kumar
Updated on 21-Jul-2023 20:25:30

98 Views

ArrayList is a class of Java Collection Framework that implements List Interface. It is a linear structure that stores and accesses each object in a sequential manner. It allows the storage of duplicate values. Always remember, each class of the collection framework can hold instances of wrapper classes or custom objects. They do not work with primitives. This article aims to explain how those objects hold by an ArrayList in Java. How ArrayList holds Objects ArrayList internally uses an array to store its elements. However, the size of the array is not fixed, it can increase and decrease as per ... Read More

Different Approaches to Concurrent Programming in Java

Shriansh Kumar
Updated on 21-Jul-2023 20:07:38

159 Views

In Java, concurrent programming is a technique that allows multiple tasks or processes to run simultaneously on a single processor or multiple processors. It can improve the performance and responsiveness of applications. However, it also introduces new challenges and complexities to the Java developers, such as synchronization and deadlock. In this article, we will explore some of the different approaches to concurrent programming such as multithreading and executors. Concurrent Programming in Java The following three components of Java are used for Concurrent Programming java.lang.Thread clas java.lang.Runnable java.util.concurrent Multithreading It is a feature of the Java programming language that ... Read More

Different Ways to Achieve Pass By Reference in Java

Shriansh Kumar
Updated on 21-Jul-2023 19:56:29

566 Views

The most frequent query asked by beginner programmers, especially those who have already worked with C and C++ in the past, is whether Java supports pass-by-referenceor pass-by-value. Generally, programming languages use pass-by-value and pass-byreferencefor passing parameters to a method. However, Java does not support both approaches rather it uses pass-by-value to pass both primitive and reference type values. But, it provides a few ways to achieve pass-by-reference, we will explore those through this article. Ways to Achieve Paas By Reference Let’s start this discussion by understanding the storage mechanism of Java. The reference variables, names of methods and classes are ... Read More

Advertisements