saving String character in arraylist
Java
//storing String character in arraylist
import java.util.*;
public class Basic_Practice2 {
public static void main(String[] args) {
String s = "Hello";
ArrayList<String> al = new ArrayList<String>();
//storing String character in arraylist
for(int i = 0; i < s.length(); i++)
{
al.add(Character.toString(s.charAt(i)));
}
// printing ArrayList
System.out.println(al);//[H,e,l,l,o]
}
}
Also in Java:
- Title
- java permutation
- Category
- Java
- Title
- how to count an replace substring string in java
- Category
- Java
- Title
- multiplication program java
- Category
- Java
- Title
- fibonacci sequence java using recursion
- Category
- Java
- Title
- Java create array of array
- Category
- Java
- Title
- check if map contains key java
- Category
- Java
- Title
- Category
- Java
- Title
- iterate map in java
- Category
- Java
- Title
- json request body not getting parsed by spring boot controller
- Category
- Java
- Title
- java self signed certificate truststore
- Category
- Java
- Title
- Java copy file
- Category
- Java
- Title
- how to create an array in java
- Category
- Java
- Title
- android elevation not working
- Category
- Java
- Title
- selection sort in java
- Category
- Java
- Title
- print in java
- Category
- Java
- Title
- inheritance in java
- Category
- Java
- Title
- how to read to into a file in java
- Category
- Java
- Title
- how to draw a line in java
- Category
- Java
- Title
- how to fill a 2d array in java
- Category
- Java
- Title
- android java shared preferences remove key
- Category
- Java
- Title
- read integer input java
- Category
- Java
- Title
- iterate through hashtable java
- Category
- Java
- Title
- java android edit text set value
- Category
- Java
- Title
- java print treemap
- Category
- Java
- Title
- java observable
- Category
- Java
- Title
- java how to print a string[]
- Category
- Java
- Title
- java list get first element
- Category
- Java
- Title
- big integer java
- Category
- Java
- Title
- java mockito print called methods
- Category
- Java
- Title
- how to check if a list is empty java
- Category
- Java
- Title
- how to exit a for loop in java
- Category
- Java
- Title
- java count substring occurrences in string
- Category
- Java
- Title
- how to send http post create request using curl command
- Category
- Java
- Title
- processing audio android
- Category
- Java
- Title
- on click android studio not working
- Category
- Java
- Title
- java quit application
- Category
- Java
- Title
- java run project from command line
- Category
- Java
- Title
- fibonacci sequence in java recursion
- Category
- Java
- Title
- java sql question mark
- Category
- Java
- Title
- read lines of file randomly java
- Category
- Java
- Title
- import classes from another project java
- Category
- Java
- Title
- arraylist to array java
- Category
- Java
- Title
- has been compiled by a more recent version of the Java Runtime (class file version 56.0), this version of the Java Runtime only recognizes class file versions up to 55.0
- Category
- Java
- Title
- calculating the percentile in java
- Category
- Java
- Title
- java check if string is number
- Category
- Java
- Title
- JavaFX mouse over effe
- Category
- Java
- Title
- java stack pop
- Category
- Java
- Title
- count number of matches in two strings java
- Category
- Java
- Title
- java loop hashmap
- Category
- Java
- Title
- android get distance between two locations kotlin
- Category
- Java
- Title
- trim() and split() in java
- Category
- Java
- Title
- bootstrap alert
- Category
- Java
- Title
- rock paper scissors java
- Category
- Java
- Title
- how to take space separated input in java
- Category
- Java
- Title
- java remove first character from string
- Category
- Java
- Title
- java newinstance alternative
- Category
- Java
- Title
- java hashmap size
- Category
- Java
- Title
- isSelfDivisor java
- Category
- Java
- Title
- insert element into arraylist java
- Category
- Java
- Title
- expression régulière téléphone java
- Category
- Java
- Title
- how to find the divisors of a number in java
- Category
- Java
- Title
- how make a final variable in java
- Category
- Java
- Title
- how to know when user is done typing android
- Category
- Java
- Title
- getordefault java
- Category
- Java
- Title
- java script how to not allow soace
- Category
- Java
- Title
- dates in java 8
- Category
- Java
- Title
- actionListener java
- Category
- Java
- Title
- parsedouble java
- Category
- Java
- Title
- java manacher's algorithm
- Category
- Java
- Title
- java exponencial
- Category
- Java
- Title
- javafx detect collision
- Category
- Java
- Title
- how to change the icon of a jframe
- Category
- Java
- Title
- fibonacci series i logn java
- Category
- Java
- Title
- java sort array descending
- Category
- Java
- Title
- switch en java
- Category
- Java
- Title
- java 8 find in list by property
- Category
- Java
- Title
- get value textfield java
- Category
- Java
- Title
- java length of matrix
- Category
- Java
- Title
- java list to array
- Category
- Java
- Title
- java list of a class has a string that is equal to
- Category
- Java
- Title
- android java how to stop users fromgoing back too much
- Category
- Java
- Title
- how to make a searchable list in java
- Category
- Java
- Title
- org.springframework.orm.jpa.EntityManagerHolder cannot be cast to org.springframework.orm.hibernate5.SessionHolder
- Category
- Java
- Title
- array rotation program in java
- Category
- Java
- Title
- java how to show an array
- Category
- Java
- Title
- ternary operator java
- Category
- Java
- Title
- java string reverse
- Category
- Java
- Title
- java last element in array
- Category
- Java
- Title
- java windowbuilder full screen
- Category
- Java
- Title
- encode file to utf-8 in java
- Category
- Java
- Title
- array in java stack overflow
- Category
- Java
- Title
- java script zip function
- Category
- Java
- Title
- kotlin jsonobject get nested
- Category
- Java
- Title
- android how to switch between activities
- Category
- Java
- Title
- intellij replace all
- Category
- Java
- Title
- how to find substring in java
- Category
- Java
- Title
- crit chance in java
- Category
- Java
- Title
- java.lang.ClassCastException: cannot be cast to javax.servlet.Servlet
- Category
- Java
- Title
- how to make an arraylist java
- Category
- Java
- Title
- remove last character from string java
- Category
- Java