+ Reply to Thread
Results 1 to 2 of 2

Thread: Reading line and print it in loop

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    8

    Reading line and print it in loop

    Lets say i have that line text : "THIS IS LINE" and i would like to print each char in a single line , i am still new at java programming , so excuse me if my question looks very simple .

  2. #2
    Junior Member
    Join Date
    Jan 2012
    Posts
    41
    You are going to use a loop to read each char in the line , so here is how it works :
    Code:
    String line = "THIS IS LINE";
    for (int i = 0; i < line.length(); i++) {
        System.out.println(line.charAt(i));
    }

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts