Tag: java programs

Frequently Asked Java Programs: 34 – Java Program to Check if Two Strings are Anagram

Hello Folks, As part of Frequently Asked Java Programs In Interviews For Freshers And Experienced, in this post we will see a java program to check if two given strings are anagram. What are Anagrams strings? Two words are called Anagrams if they have the same characters with same number of occurance. For example:- SILENT and […]

Frequently Asked Java Programs: 33 – Insert a String into Another String at given index

Hello Folks, As part of Frequently Asked Java Programs In Interviews For Freshers And Experienced, in this post we will see a java program to Insert a String into Another String at given index. Problem Statement:- String s1 = MakeEasy String s2= Selenium indexToInsertS2= 4 Insert s2 in to s1 at index 4th. So s1 should […]

Frequently Asked Java Programs: 32 – Swap Two String Variables Without Using Third Variable

Hello Folks, As part of Frequently Asked Java Programs In Interviews For Freshers And Experienced, in this post we will see a java program to swap two String variables without using third variable. Problem Statement:- Before Swapping: String s1= “Java”; String s2= “Selenium”; After Swapping: String s1= “Selenium”; String s2= “Java”; We have already seen Swapping […]

Frequently Asked Java Programs 31 – Java Program to Find Common Characters in Two Given Strings

Hello Folks, As part of Frequently Asked Java Programs In Interviews For Freshers And Experienced, in this post we will see a java program Find Common Characters in Two Given Strings. Problem Statement:- String s1= “ABCDEF” String s2= “DEFXYZ” Output: DEF Solution:- This problem can be solved with or without using collection concepts in Java. I […]

Frequently Asked Java Program 30: Java Program to Find Distinct Characters In Given String

Hello Folks, As part of Frequently Asked Java Programs In Interviews For Freshers And Experienced, in this post we will see a java program to Find Distinct Characters In Given String. Problem Statement: User input: Make Selenium Easy Output: K L N I U Y Problem Solution:  Logic: Convert input string in to same case either upper […]

Frequently Asked Java Program 22: Java Program to Trim Whitespace From String Without Using Trim Method

Hello Folks, This interview question was asked in Deloitte.  Write a java program to Trim a given string without using inbuilt trim() method of String Class in Java. “trim()” method of String class trims leading and trailing whitespace/s of given string. It does not remove whitespace between words. We need to write logic to do so. […]

Please wait...

Subscribe to new posts to become automation expert

Want to be notified when my new post is published? Get my posts in your inbox.