Found 7442 Articles for Java

Java Integer Cache

Rushi Javiya
Updated on 24-Jul-2023 12:37:54

660 Views

Java is one of the most used programming languages nowadays, as it contains advanced features and functionalities. In every new version of Java, its developers add new features and functionalities, and an integer cache is one feature introduced in Java 5. In this tutorial, we will understand what integer cache is in Java and the importance of that in programming. What is Integer Cache in Java? From the 'cache' word, readers can guess that we are talking about storing integer in the memory and reusing it whenever required. Yes, you have guessed correctly. But the question comes to mind is ... Read More

Java Equivalent of C++'s lower_bound() Method

Rushi Javiya
Updated on 24-Jul-2023 12:37:21

1K+ Views

In this problem, we will learn to implement the equivalent algorithm of C++'s lower_bound() method in Java to find the lower bound index of a given element in the sorted array. Lower bound − The lower bound is the index in the sorted array, such that the index contains the minimum element greater or equal to the targeted element. We can use the searching algorithms to find the lower bound of any element in the sorted array without using built-in methods. Here, we will use the linear search, iterative, and recursive binary search to get the lower bound of any ... Read More

ProcessBuilder in Java to create a basic online Judge

Shriansh Kumar
Updated on 21-Jul-2023 22:36:54

273 Views

Online judge is a platform that serves to compile, execute and evaluate programming solutions to a given problem. It is widely used for problem solving and organizing programming contests. To create a basic online judge in Java using ProcessBuilder class, define an instance of ProcessBuilder and specify the name of program and commands as arguments The ProcessBuilder class is used to create and manage operating system processes. It allows us to chain multiple processes, where the output of one process can be used as the input to another process. Also, it provides a variety of built-in methods such as redirectOutput(), ... Read More

How to Add JAR file to Classpath in Java?

Shriansh Kumar
Updated on 21-Jul-2023 22:27:58

5K+ Views

While developing any Java application, we may require to use external libraries or modules that are packaged as JAR files. To use a JAR file in those Java applications, we need to add it to the classpath, which is a list of locations where the Java runtime can find and load classes. This article aims to explain how to add a JAR file to the classpath. We will start this explanation by introducing JAR Files. Java JAR File The full form of JAR is Java Archive File. Java provides this feature to bundle multiple Java program files as well as ... Read More

Difference between JIT and JVM in Java

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

937 Views

When we start learning Java, we often come across the terms like JIT and JVM. Having a good understanding of the relationship and differences between both terms is crucial, as they are part of fundamental concepts in the Java programming language. JVM is the main component of the Java Runtime Environment that executes Java bytecode, whereas JIT is a compiler available in the JVM. This article aims to explain the difference between JIT and JVM. JIT vs JVM in Java JVM It is an acronym that stands for Java Virtual Machine. The name itself suggests that it is something that ... Read More

Difference Between Source Code and Byte Code

Shriansh Kumar
Updated on 21-Jul-2023 22:13:36

1K+ Views

When we start learning Java, we often come across the two terms Source code and Byte code. When a programmer writes Java code, it is in a form that a machine cannot understand. This code is termed as source code, which is easy to read and modify by humans, but not by machines. Therefore, before execution of code, we need to convert it into a machine readable format that is termed as machine code. However, Java first converts the source code to an intermediate code called byte code and then, into a machine code. Let’s discuss the difference between the ... Read More

Difference Between Length and Capacity in Java

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

753 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

984 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

539 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

174 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

Advertisements