Shriansh Kumar has Published 324 Articles

How HashTable Works Internally in Java?

Shriansh Kumar

Shriansh Kumar

Updated on 20-Jul-2023 22:15:06

3K+ Views

The Hashtable class is a part of the Java Collection Framework that stores its element in key-value pairs in a hash table. The Key is an object that can be used to fetch and receive value associated with it. There exist a few similarities between a Hashtable and HashMapclass but ... Read More

How does Java process the backspace terminal control character?

Shriansh Kumar

Shriansh Kumar

Updated on 20-Jul-2023 22:10:46

986 Views

The backspace terminal control character is a special character represented by the ‘\b’notation. It is used to move the cursor one character back. It comes under Java escape characters, these characters are used with backslash (\) and hold a special meaning to the compiler. In this article, we will understand ... Read More

Different Ways to Copy Files in Java

Shriansh Kumar

Shriansh Kumar

Updated on 20-Jul-2023 22:05:36

2K+ Views

Java provides different ways to copy files including the ‘File’, ‘FileInputStream’ and‘FileOutputStream’ classes. There are times when we need to take a backup, compress a file or share it with others. In these situations, copying that file becomes necessary. Weare going to explore the methods and classes that will help ... Read More

Different Method Calls in Java

Shriansh Kumar

Shriansh Kumar

Updated on 20-Jul-2023 21:40:19

220 Views

Java provides different method calls techniques that we can use according to the need andscenario in our program. Here, methods mean a block of code that can be reused multipletimes to perform a single operation. It saves our time and also reduces the size of code.The method call is referred ... Read More

How are parameters passed in Java?

Shriansh Kumar

Shriansh Kumar

Updated on 20-Jul-2023 21:19:58

1K+ Views

The most frequent query asked by beginner programmers is that how are parameters passed in Java. Generally, the programming languages use pass by value and pass byreference for passing parameters to a method. However, Java does not support both approaches rather it uses pass by value to pass both primitive ... Read More

Different Ways to Create the Instances of Wrapper Classes in Java

Shriansh Kumar

Shriansh Kumar

Updated on 20-Jul-2023 21:14:47

405 Views

To encapsulate or represent a primitive datatype within an object, Java provides theconcept of Wrapper classes. All eight wrapper classes are as follows Double, Float, Long, Integer, Short, Byte, Character, and Boolean. These classes have a variety of in-builtmethods that allows us to integrate primitives into their respective instances as ... Read More

Different Ways to Print First K Characters of the String in Java

Shriansh Kumar

Shriansh Kumar

Updated on 20-Jul-2023 21:09:15

258 Views

A string is a class in Java that stores a series of characters enclosed within double quotes.Those characters are actually String-type objects. The string class is available in the‘java.lang’ package. Suppose we have given a string and a positive integer ‘k’. Now, thejob is to print that string's first 'k' ... Read More

Getting Least Value Element From a Set by Using Sorting Logic on TreeSet in Java

Shriansh Kumar

Shriansh Kumar

Updated on 20-Jul-2023 21:06:28

97 Views

TreeSet is a class of Java Collection Framework that implements the SortedSet Interface.It stores elements in ascending order and does not allow duplicate values therefore, theaccess and retrieval time becomes faster. Because of this excellent feature, TreeSet isfrequently used to store large amounts of information that need to be searched ... Read More

Getting Highest and Lowest Value Element From a Set by using Sorting Logic on TreeSet in Java

Shriansh Kumar

Shriansh Kumar

Updated on 20-Jul-2023 21:02:54

191 Views

TreeSet is a class of Java Collection Framework that implements the SortedSet Interface.It stores elements in ascending order and does not allow duplicate values therefore, theaccess and retrieval time becomes faster. Because of this excellent feature, TreeSet isfrequently used to store large amounts of information that need to be searched ... Read More

How to Add Custom Class Objects to the TreeSet in Java?

Shriansh Kumar

Shriansh Kumar

Updated on 20-Jul-2023 20:14:00

1K+ Views

TreeSet is a class of Java Collection Framework that implements the SortedSet Interface. Remember that it stores elements in ascending order and does not allow duplicate values. We need to stick with this condition while adding custom class objects to the TreeSet otherwise we will encounter a ClassCastException. Here, custom ... Read More

Advertisements