Create StringIterator.java
This commit is contained in:
parent
c0d76384a4
commit
450b6d8025
|
@ -0,0 +1,14 @@
|
|||
package com.baeldung.stringIterator;
|
||||
|
||||
public class StringIterator {
|
||||
public static void main(String[] args) {
|
||||
String str = "Hello, Baeldung!";
|
||||
java8forEach(str);
|
||||
}
|
||||
|
||||
public static void java8forEach(String str){
|
||||
str.chars().forEach(name -> {
|
||||
System.out.print((char) name);
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue