Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

public class Main {
    public static void main(String[] args) {
        String r = "This is a test.";
        String[] s = new String[10];
        int len = r.length();
        int l = 3;
        int last;
        int f = 0;
        for (int i = 0;; i++) {
            last = (f + l);
            if ((last) >= len) {
                last = len;
            }
            s[i] = r.substring(f, last);
            System.out.println(s[i]);

            if (last == len) {
                break;
            }
            f = (f + l);
        }
    }
}