Create StringIterator.java

This commit is contained in:
Neetika23 2023-10-26 23:25:17 +05:30 committed by GitHub
parent c0d76384a4
commit 450b6d8025
1 changed files with 14 additions and 0 deletions

View File

@ -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);
});
}
}