java recursion
Java
public void removeDigits(String string) {
if(string.length == 1) {
if(Character.isDigit(string.CharAt(0))) {
return "";
} else {
return string;
}
} else {
if(Character.isDigit(string.CharAt(0))) {
return removeDigits(string.substring(1));
} else {
return string.substring(0, 1) + removeDigits(string.substring(1));
public static void main(String[] args) {
String string = "1a2b3c"
System.out.println(removeDigits(string)); //will print "abc"
}// prints x number of $
public static void recursion(int x) {
if(x == 0) { // base case
System.out.println();
} else { // recursive case
System.out.print("$");
recursion(x - 1);
}
}
Also in Java:
- Title
- color from hex code flutter
- Category
- Java
- Title
- break for loop java
- Category
- Java
- Title
- how to remove all components from layeredPane java
- Category
- Java
- Title
- how to print a 2d array in java
- Category
- Java
- Title
- org.springframework.orm.jpa.EntityManagerHolder cannot be cast to org.springframework.orm.hibernate5.SessionHolder
- Category
- Java
- Title
- how to declare array java
- Category
- Java
- Title
- searching in database using java
- Category
- Java
- Title
- convert string to array java
- Category
- Java
- Title
- java simple jframe example
- Category
- Java
- Title
- bigdecimal divide java
- Category
- Java
- Title
- pass list to intent in android java
- Category
- Java
- Title
- java processbuilder example
- Category
- Java
- Title
- java hashmap size
- Category
- Java
- Title
- java random char a-z
- Category
- Java
- Title
- java return new instance of generic type
- Category
- Java
- Title
- arraylist to int array java
- Category
- Java
- Title
- count occurrences of character in string java 8
- Category
- Java
- Title
- in javascipt how to stop further page processing
- Category
- Java
- Title
- binary search tree insert java
- Category
- Java
- Title
- java get command line input
- Category
- Java
- Title
- java list to array
- Category
- Java
- Title
- get first character of string java
- Category
- Java
- Title
- java pass arraylist by value
- Category
- Java
- Title
- output statement java
- Category
- Java
- Title
- array in line java
- Category
- Java
- Title
- java min function
- Category
- Java
- Title
- find duplicate elements in array in java
- Category
- Java
- Title
- count number of matches in two strings java
- Category
- Java
- Title
- java split string
- Category
- Java
- Title
- how to crate a list in java script
- Category
- Java
- Title
- java script to detect the crome browser
- Category
- Java
- Title
- java how to call getReader twice
- Category
- Java
- Title
- java output length of each line in a text document
- Category
- Java
- Title
- recursive function for fibonacci series in java javascript
- Category
- Java
- Title
- java getter
- Category
- Java
- Title
- java valeur absolue
- Category
- Java
- Title
- how to add multiple filter condition in Java stream filter chain
- Category
- Java
- Title
- java loop
- Category
- Java
- Title
- java 8 find min value in array
- Category
- Java
- Title
- how to return the lower of two values in one line java
- Category
- Java
- Title
- system.arraycopy java
- Category
- Java
- Title
- java public private key encryption
- Category
- Java
- Title
- comparable on a generic class java
- Category
- Java
- Title
- print hello world in java
- Category
- Java
- Title
- how to append to a string in java
- Category
- Java
- Title
- StringBuilder java pop back
- Category
- Java
- Title
- java loop through array
- Category
- Java
- Title
- entre clavier java
- Category
- Java
- Title
- adb: command not found
- Category
- Java
- Title
- java clone method
- Category
- Java
- Title
- java hashmap example
- Category
- Java
- Title
- elasticsearch api code call using highlevelrestclient
- Category
- Java
- Title
- simple javascript to detect browser using java utils
- Category
- Java
- Title
- how to use an abstract class in java
- Category
- Java
- Title
- how to draw a line in java
- Category
- Java
- Title
- simple calculator program in java
- Category
- Java
- Title
- java regex replace all characters before
- Category
- Java
- Title
- select photo from camera android
- Category
- Java
- Title
- dates in java 8
- Category
- Java
- Title
- android create notification
- Category
- Java
- Title
- java lerp
- Category
- Java
- Title
- how to compare current date and time with another date and time in android
- Category
- Java
- Title
- java map print
- Category
- Java
- Title
- how to print ascii value in java
- Category
- Java
- Title
- counting the number of characters in a string java
- Category
- Java
- Title
- print arraylist java
- Category
- Java
- Title
- how to declare list of object in java as constant
- Category
- Java
- Title
- java resultset to table
- Category
- Java
- Title
- java nextpermutation
- Category
- Java
- Title
- input java
- Category
- Java
- Title
- python to java converter
- Category
- Java
- Title
- snackbar not showing with bottom nav
- Category
- Java
- Title
- java how to print a newline
- Category
- Java
- Title
- how to split a string in java
- Category
- Java
- Title
- http client java
- Category
- Java
- Title
- java vs python
- Category
- Java
- Title
- how to check if a list is empty java
- Category
- Java
- Title
- java how to print an array
- Category
- Java
- Title
- difference between compile and execute in java
- Category
- Java
- Title
- int to long java
- Category
- Java
- Title
- create java windows application
- Category
- Java
- Title
- read from elasticsearch in spark
- Category
- Java
- Title
- eclipse does not support logback with spring boot
- Category
- Java
- Title
- byte java
- Category
- Java
- Title
- show menuitem when menu hovered javafx
- Category
- Java
- Title
- how to skip a line in java
- Category
- Java
- Title
- java variable declaration
- Category
- Java
- Title
- read integer input java
- Category
- Java
- Title
- how to use spring in java
- Category
- Java
- Title
- java localdate subtract two dates
- Category
- Java
- Title
- print map java
- Category
- Java
- Title
- string method example in java
- Category
- Java
- Title
- compare list from db and list from request
- Category
- Java
- Title
- isSelfDivisor java
- Category
- Java
- Title
- how to exit a java program
- Category
- Java
- Title
- convert char to string java
- Category
- Java
- Title
- priority queue in java
- Category
- Java
- Title
- java display message
- Category
- Java
- Title
- inheritance in java
- Category
- Java
- Title
- java arraylist to string
- Category
- Java