java iterate over a string
String scientistName = "Isaac Newton";
for (int i = 0; i < scientistName.length(); i++) {
System.out.print(scientistName.charAt(i) + " "); // I s a a c N e w t o n
}
//*********************************************************
// you can cast a string into a char[]
String str = "strings are not primitive types!";
for (char ch : str.toCharArray()) {
System.out.print(scientistName.charAt(i) + " ");
}
}
Also in Java:
- system.arraycopy java
- vertical traversal of binary tree
- java override equals and hashcode
- java how to get all threads
- split every character in string into array java
- Java's BigInteger class
- java random numbers in specific range
- how to minimize jframe in java
- math minimum java
- how to compare two maps in java
- capcitor FERR_CLEARTEXT_NOT_PERMITTED
- android studio remove notification bar
- java obtain list string from list object
- java uuid
- how to set a variable java
- close scanner java
- guess the number java
- how to change maven java version in po,
- How can I put a parameter into a localized string in Android?
- counting the sequence of character in string java
- how to count an replace string in java
- java round double to 2 decimal places
- islowercase java
- java treeset