Skip to content

Tag Archives: Java-String-Programs

Given a string, remove all the leading and trailing spaces from the string and return it. Examples: Input : str = " Hello World "… Read More
This article discusses different ways to reverse a string in Java with examples.  Examples:   Recommended: Please try your approach on {IDE} first, before moving on… Read More
Strings are a very important aspect from a programming perspective as many questions can be framed out among strings. There arise wide varied sets of… Read More
1. Strings are immutable:  Strings are immutable in Java and therefore if a password is stored as plain text it will be available in memory until Garbage… Read More
Given two string variables, a and b, your task is to write a Java Program to swap these variables without using any temporary or third… Read More
As we all know String is immutable in java so do it gives birth to two ways of initialization as we do have the concept… Read More
Try to figure out the output of this code: public class Test {     public static void main(String[] args)     {         System.out.println(45+5 + "=" +45+5);     } }… Read More
Splitting a string by some delimiter is a very common task. For example, we have a comma-separated list of items from a file and we… Read More
Given a set of characters and a positive integer k, print all possible strings of length k that can be formed from the given set.… Read More