- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 2617 Articles for Java
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
1K+ Views
In this article, we will understand how to format time in AM-PM format. A formatting string describes how a date/time values should be read and written from(to) string representation (flat files, human readable output, etc.)Below is a demonstration of the same −Suppose our input is −Current date: Thu Mar 17 16:04:31 IST 2022The desired output would be −The current Time in AM/PM format is : 04.04 pmAlgorithmStep 1 - START Step 2 - Declare a date object namely current_date that fetches the current date and time. Step 3 - Define the values. Step 4 - Declare an object ‘formatTime’ of ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
108 Views
In this article, we will understand how to get the size of the collection. The Collection is a framework that provides architecture to store and manipulate the group of objects. Java Collections can achieve all the operations that you perform on a data such as searching, sorting, insertion, manipulation, and deletion.Below is a demonstration of the same −Suppose our input is −Input list: [100, 180, 250, 300]The desired output would be −The size of the list = 4AlgorithmStep 1 - START Step 2 - Declare a list namely input_list. Step 3 - Define the values. Step 4 - Using the ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
1K+ Views
While displaying a long input string, we are sometimes required to process them in smaller units. At that time, converting that string into the InputStream will be helpful. To convert a given string into the InputStream, Java provides ByteArrayInputStream class that is used along with a built method named getBytes(). In this article, we will learn how we can use the ByteArrayInputStream class to convert a string into an InputStream with the help of example programs. Java Program to Convert a String into the InputStream This section will introduce a few concepts that will help us to understand the Java ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
552 Views
In this article, we will understand how to compare elements in a collection. The Collection is a framework that provides architecture to store and manipulate the group of objects. Java Collections can achieve all the operations that you perform on a data such as searching, sorting, insertion, manipulation, and deletion.Below is a demonstration of the same −Suppose our input is −Input list: [300, 500, 180, 450, 610]The desired output would be −Min value of our list : 180 Max value of our list : 610AlgorithmStep 1 - START Step 2 - Declare a list namely input_list Step 3 - Define ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
589 Views
In this article, we will understand how to print a collection. The Collection is a framework that provides architecture to store and manipulate the group of objects. Java Collections can achieve all the operations that you perform on a data such as searching, sorting, insertion, manipulation, and deletion.Below is a demonstration of the same −Suppose our input is −Run the programThe desired output would be −The Elements of the collection are: Language : Java | Language_id : 101 Language : Scala | Language_id : 102 Language : Python | Language_id : 103 Language : Mysql | Language_id : 104AlgorithmStep 1 ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
622 Views
In this article, we will understand how to lookup enum by string value. An enum is a special "class" that represents a group of constants (unchangeable variables, like final variables).Below is a demonstration of the same −Suppose our input is −The string is to lookup is: JavaThe desired output would be −The result is: JAVAAlgorithmStep 1 - START Step 2 - Declare a string namely input_string, an object of Languages namely result. Step 3 - Define the values. Step 4 - Use the function .valueOf() to fetch the string from the enum function. Step 5 - Display the result Step ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
170 Views
In this article, we will understand how to implement switch statement on strings. The switch expression is evaluated once. The value of the expression is compared with the values of each case. String is a datatype that contains one or more characters and is enclosed in double quotes(“ ”).Below is a demonstration of the same −Suppose our input is −Input string: JavaThe desired output would be −Using siwtch cases: We shall use Java for our codingAlgorithmStep 1 - START Step 2 - Declare a string namely input_string. Step 3 - Define the values. Step 4 - Define a stwtch statement ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
867 Views
In this article, we will understand how to replace the spaces of a string with a specific character. String is a datatype that contains one or more characters and is enclosed in double quotes(“ ”).Below is a demonstration of the same −Suppose our input is −Input string: Java Program is fun to learn Input character: $The desired output would be −The string after replacing spaces with given character is: Java$Program$is$fun$to$learnAlgorithmStep 1 - START Step 2 - Declare a string namely input_string, a char namely input_character. Step 3 - Define the values. Step 4 - Using the function replace(), replace the ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
243 Views
In this article, we will understand how to join two lists. The ArrayList class extends AbstractList and implements the List interface. ArrayList supports dynamic arrays that can grow as needed.Array lists are created with an initial size. When this size is exceeded, the collection is automatically enlarged. When objects are removed, the array may be shrunk.Below is a demonstration of the same −Suppose our input is −First list is defined as: [Java, Python] Second list: [Mysql, Redshift]The desired output would be −The list after joining two strings: [Java, Python, Mysql, Redshift]AlgorithmStep 1 - START Step 2 - Declare two lists ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
318 Views
In this article, we will understand how to access elements from a linked-list. The java.util.LinkedList class operations perform we can expect for a doubly-linked list. Operations that index into the list will traverse the list from the beginning or the end, whichever is closer to the specified index.Below is a demonstration of the same −Suppose our input is −Input list: [Python, Java, Scala, Java, JavaScript]The desired output would be −The element at index 3 is: JavaAlgorithmStep 1 - START Step 2 - Declare a linked list namely input_list. Step 3 - Define the values. Step 4 - Using the built-in ... Read More