
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 7442 Articles for Java

233 Views
In the domain of concurrent programming in Java, controlling access to shared resources is crucial. This need is often fulfilled through synchronization mechanisms such as locks and monitors. However, these tools typically only protect a single instance of a resource. What if you have multiple copies of a resource and you need to control access to them? This is where Semaphores come into play. In this article, we will delve into the usage of Semaphores to protect more than one copy of a resource in Java. Understanding Semaphores Semaphore is a synchronization mechanism that controls access to one or more ... Read More

567 Views
In the dynamic world of Java programming, achieving optimal performance is often the central goal of developers. In this realm, different wait strategies, including busy spinning, can play a pivotal role. This article aims to provide a detailed understanding of busy spinning as a wait strategy in Java, why it's important, and how it can be efficiently utilized. Understanding Wait Strategies In concurrent programming, wait strategies determine how a thread should wait when there is no work available for it. Different wait strategies can drastically impact the performance of concurrent applications. A commonly used approach is blocking, where a thread ... Read More

194 Views
In the world of Java programming, Google's open-source Guava library introduces powerful utilities that bolster the Java developer's toolkit. Among these, Guava's Collectors bring a unique enhancement, enabling a seamless transition of data from streams to immutable collections. This article provides a detailed guide on leveraging Guava's Collectors for collecting streams into immutable collections in Java. The Power of Immutable Collections Immutable objects have a fixed state after their creation, which means they cannot be modified. This property brings a host of benefits, including simplicity, thread-safety, and the guarantee that they will always remain in a consistent state. Java's core ... Read More

240 Views
Geometrical computations play an essential role in various domains of computer science such as computer graphics, gaming, and computational geometry. Among the myriad of geometric operations, determining whether two lines intersect is a fundamental problem. In this article, we'll take an in-depth look at how to test if two lines intersect using the above/below primitive method in Java Understanding the Concept The above/below primitive is a fundamental concept in computational geometry. It helps determine whether a point lies above, below, or on a line. To assess whether two lines intersect in the two-dimensional plane, one needs to check if the ... Read More

2K+ Views
In this article, we will learn the procedures for sorting a HashMap in Java by its keys and values, as well as examine the performance implications associated with each technique. HashMap, a frequently employed data structure, enables programmers to store key-value pairs. This data structure is an exceedingly efficient method for storing data and allows for swift value retrieval based on keys. However, on occasion, it may become necessary to arrange the HashMap by its keys or values. Different Approaches of Sorting the HashMap Following are the different approaches to sorting a HashMap by Keys and Values − ... Read More

3K+ Views
Unicode is an international character set that encompasses a vast range of characters, symbols, and scripts from many languages across the globe. Java programming language, being platform-independent, has built-in support for Unicode characters, allowing developers to create applications that can work seamlessly with diverse languages and scripts. In Java, the char data type is used to store Unicode characters, and character literals are used to represent these characters in the source code. A character literal is a single Unicode character enclosed in single quotes (' ') and can be assigned directly to a char variable. Algorithm Step 1 ... Read More

909 Views
In the vast landscape of Java programming, one of the most intriguing aspects is its choice of variable naming. Among these, the use of the underscore (_) is a topic that has sparked much discussion and debate. This article will delve into the usage of underscore as a variable name in Java, exploring its evolution across different Java versions and its current status in the Java programming world. The Saga of the Underscore in Java A unique aspect of Java programming lies in its allowance for naming variables. Underscore, or "_", is a valid character that can be used in ... Read More

1K+ Views
In the realm of Java programming, the actionPerformed method is a central aspect of handling event-driven programming concepts. It is part of the ActionListener interface and helps manage user interactions with GUI components. In this article, we will explore how to utilize the actionPerformed method from another Java class, enhancing the modularity and readability of your code. Understanding actionPerformed and ActionListener Before we proceed, let's delve into what action Performed and Action Listener are. The Action Listener interface is part of the java.awt.event package. It includes the action Performed method, which is triggered when an action event occurs, such as ... Read More

475 Views
In computer programming, it's essential to keep data well-organized and easy to access and modify. The Vector is a flexible array that can grow or shrink as needed, making it an important data structure for this purpose. In Java, Vectors are especially useful because they allow you to store different types of objects together.In this guide, we’ll learn to swap elements in a Vector in Java. Swapping elements is a common task, especially when sorting or rearranging data. We’ll show two different ways to do this, with examples and clear explanations. Syntax Vector vector = new Vector(); // Create a ... Read More

735 Views
In the Java programming language, the process of converting one data type to another is known as typecasting. At times, it becomes necessary to convert an integer data type to a byte data type. However, it is crucial to have an understanding of the byte data type's range. The byte data type is an 8-bit signed two's complement integer that has a minimum value of -128 and a maximum value of 127. If the integer value falls within this range, then it can be directly typecast to a byte variable. However, if the integer value is not within this range, ... Read More