Revathi Satya Kondra has Published 101 Articles

Java Program to Differentiate String == operator and equals() method

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 06-Jan-2025 22:46:56

290 Views

In this article, we will understand how to differentiate == operator and equals() method in Java. The == (equal to) operator checks if the values of two operands are equal or not, if yes then the condition becomes true. The equals() method compares this string to the specified object. The ... Read More

Java Program to remove whitespace from the beginning and end of a string

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 31-Dec-2024 11:18:24

547 Views

In this article, we use the trim() method to remove whitespace at the beginning and end of a string. This method does not modify the original string; instead, it returns a new string with the leading and trailing whitespace removed. Let’s say the following is our string with whitespace ... Read More

Java Connection setHoldability() method with example

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 30-Dec-2024 19:20:39

461 Views

ResultSet holdability determines whether the ResultSet objects (cursors) should be closed or held open when a transaction (that contains the said cursor/ ResultSet object) is committed using the commit() method of the Connection interface. The setHoldability() method of the Connection interface is used to set the holdability of the ResultSet objects in ... Read More

Java Program to replace key and value in HashMap with identical key and different values

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 30-Dec-2024 19:17:32

419 Views

In Java, the HashMap class is a part of the Java.util package and provides a convenient way to store key-value pairs. Sometimes, We need to update the values of existing keys while keeping the keys identical. This can be easily achieved using the put() method, replace() method, and computeIfPresent() method ... Read More

Formatted Output in Java

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 26-Dec-2024 20:45:17

3K+ Views

In Java, the formatted output refers to a process of generating well-structured data by specifying how data should be displayed. It involves using format specifiers to control the appearance (visibility) of various data types, such as integers, floating-point numbers, strings, characters, and dates. In this article, we will discuss two ... Read More

How to convert an input stream to byte array in java?

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 26-Dec-2024 20:44:18

2K+ Views

The InputStream class in Java provides read() method. This method accepts a byte array and it reads the contents of the input stream to the given byte array. To convert an InputStream to a byte array, We can use the ByteArrayOutputStream class to read data from the InputStream and write ... Read More

Left justify output in Java

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 24-Dec-2024 12:04:36

3K+ Views

In Java, the left-justifying output means aligning text or data to the left within a specified width, with extra spaces on the right to fill the remaining space. It is commonly used when displaying tabular data or formatting strings. Left justification can be obtained using methods such as String.format() or printf(), ... Read More

What is the use of marker interfaces in Java?

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 23-Dec-2024 11:16:25

718 Views

An interface with no methods in it is referred to as a marker interface, also known as a tagging interface. There are two basic design purposes of marker interfaces. Creates a common parent  It is used to provide a common parent interface for a group of related interfaces. When an interface ... Read More

Display two-digit month in Java

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 23-Dec-2024 11:15:55

3K+ Views

In this article, we will discuss how to display the two-digit month. A two-digit month ensures that even the first month (i.e., January) is formatted to display as 01 instead of 1. This formatting provides a consistent two-digit representation for all months. To Display two-digit month in Java is quite ... Read More

Create an Integer object in Java

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 18-Dec-2024 22:42:09

7K+ Views

To create an Integer object in Java is quite easy. Let us learn about the following two ways for this purpose. Before moving to the coding section, let's briefly discuss the Integer class. The Integer class is a wrapper class in Java, which can be used to encapsulate a primitive ... Read More

Advertisements