Write a code to prove that strings are immutable in java?7 Jan 2025 | 1 min read Following program demonstrate it. File: ProveStringImmutable .java Output: Before Modification in st1 Both pointing to the same reference After Modification Both are pointing to different reference |
It is a very interesting problem frequently asked in interviews of top IT companies like Google, Amazon, TCS, Accenture, Adobe, Apple, Infosys, etc. By solving the problem, one wants to check the logical ability, critical thinking, and problem-solving skill of the interviewee. So, in this section,...
5 min read
In this section, we will learn how to create a Java program to display alternate prime numbers. Prime Number: A prime number is a number p such that whenever p divides ab, then either p divides a or p divides b. In other words, a number that...
2 min read
Java Program to print Odd and Even Numbers from an Array We can print odd and even numbers from an array in java by getting remainder of each element and checking if it is divided by 2 or not. If it is divided by 2, it is...
1 min read
Java Convert float to String We can convert float to String in java using String.valueOf() and Float.toString() methods. Scenario It is generally used if we have to display float value in textfield because everything is displayed as a string in form. 1) String.valueOf() The String.valueOf() is an overloaded method. It can...
1 min read
In this program, we need to multiply two matrices and print the resulting matrix. Product of two matrices The product of two matrices can be computed by multiplying elements of the first row of the first matrix with the first column of the second matrix then, add...
6 min read
A prime number is a number that is greater than 1 and divided by 1 or itself. In other words, prime numbers cannot be divided by other than itself or 1. For example, 2, 3, 5, 7, 11, 13, 17... are the prime numbers. Note: 0 and...
6 min read
Two Strings are called the anagram if they contain the same characters. However, the order or sequence of the characters can be different. In this program, our task is to check for two strings that, they are the anagram or not. For this purpose, we are...
3 min read
In this section, we will learn what is xylem and phloem number and also create Java programs to check if the given number is xylem or phloem. The xylem and phloem number program frequently asked in Java coding tests and academics. Xylem and Phloem Number A number N...
2 min read
In this program, we will create a circular linked list and delete a node from the middle of the list. If the list is empty, display the message "List is empty". If the list is not empty, we will calculate the size of the list...
9 min read
In this program, we need to create a singly linked list and display the list in reverse order. Original List Reversed List One of the approaches to solving this problem is to reach the end the of the list and display the nodes from tail to head recursively. Algorithm Create...
5 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India