desislava_topuzakova

05. Stream of letters

Nov 28th, 2021
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. package ForLoop;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class StreamOfLetters_05 {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8. String text = scanner.nextLine();
  9. //всяка една позиция в текста (0 до последната: дължина - 1) -> да отпечатаме символа, който се намира на текущата позиция
  10. for (int position = 0; position <= text.length() - 1; position++) {
  11. char currentSymbol = text.charAt(position);
  12. System.out.println(currentSymbol);
  13. }
  14.  
  15. }
  16. }
  17.  
Advertisement
Add Comment
Please, Sign In to add comment