Write a java program to find factorial of a number in java?
Factorial of a number : For a given value n the factorial of a number is product of all natural numbers less than given value n.
Ex : n!= n * (n-1) * (n-2) *(n-3)
5!=5*4*3*2*1 Continue reading
This is one of the frequently asked interview question in interview.So lets begin writing the program by writing the pseudo code.
Pseudo Code :
1) Create a new empty hashmap.
2) This map is used to store the values and the number of times it got repeated.
3) Loop through each value in array and check whether that value is present in map or not.
4) If that value is present in map increment the count.otherwise store that value with count 1.
5) Finally loop through the map and print the values which are greater than 1 which will give you the list of duplicate values. Continue reading
Remove HTML tags from String in java
This tutorial explains how to remove html tags from a string in java.For example I have a string with html tags and i want only content between tags.
String htmlString=”<head>welcome to java Interview questions website</head> “;
In the above string if we want only content by remove tags, we can use regular expressions to do the same. Continue reading