Advertisement
desislava_topuzakova

05. Character Sequence

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