Found 2616 Articles for Java

Difference Between Length and Capacity in Java

Shriansh Kumar
Updated on 21-Jul-2023 22:10:03

355 Views

In Java, the two terms length and capacity are related to the storage of elements in a collection like arrays, String and ArrayList. Length refers to the number of elements that are currently stored in a given collection, whereas capacity refers to the maximum number of elements that the collection can hold. In this article, we will explore the difference between Length and Capacity in Java. Length vs Capacity in Java Length To get the length of an array we use its ‘length’ property and we can get length of a String using its built-in method ‘length()’. In the ... Read More

getParameter() - Passing data from client to JSP

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

467 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

Difference Between URL, URI and URN in Java

Shriansh Kumar
Updated on 21-Jul-2023 21:45:10

283 Views

The modern Internet is all about the World Wide Web which holds billions of websites and resources. There are several ways to access those web-based resources by following the protocols. Java has the concept of networking that is used to establish communication between clients and those resources. But, to locate a specific resource among the millions available, we need a unique identifier. There are three components: URI, URL and URN that helps us locate a certain resource on the web. Together they serve a single purpose, but through this article, we will discuss the difference between URI, URL and URN. ... Read More

Difference Between URL and URN in Java

Shriansh Kumar
Updated on 21-Jul-2023 21:19:47

80 Views

The modern day Internet is all about the World Wide Web which holds billions of websites and resources. There are several ways to access those web-based resources by following the protocols. Java has the concept of networking that is used to establish communication between clients and those resources. But, to locate a specific resource among the millions available, we need a unique identifier. There are three components: URI, URL and URN that helps us locate a certain resource on the web. In this article, we will point out some differences between URL and URN in Java. URL vs URN in ... Read More

Difference Between URI and URN in Java

Shriansh Kumar
Updated on 21-Jul-2023 21:13:59

56 Views

The modern day Internet is all about the World Wide Web which holds billions of website and resources. There are several ways to access those web-based resources by following the protocols. Java has the concept of networking that is used to establish communication between clients and those resources. But, to locate a specific resource among the millions available, we need a unique identifier. There are three components: URI, URL and URN that helps us locate a certain resource on the web. This article aims to explain the difference between URI and URN in Java. URI vs URN in Java URI ... Read More

Difference Between JavaEE and Spring

Shriansh Kumar
Updated on 21-Jul-2023 21:04:32

786 Views

The debate about JavaEE and Spring is very common among Java developers. Both technologies emerged as popular frameworks for building enterprise applications using Java. Java EE is a more adaptable and distributed framework for developing big software. Spring, on the other hand, is open source and makes use of the POJO programming model to develop any type of Java application. Let’s find out more detailed differences between JavaEE and Spring through this article. JavaEE vs Spring JavaEE Java Platform Enterprise Edition, in short JavaEE is a set of specifications defined by Oracle. It is also known as J2EE. It aims ... Read More

Getting Set View of Keys from HashMap in Java

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

261 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

248 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

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

Advertisements