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) {
        System.out.println("\nName Length is:" + len("java2s.com"));
    }

    public static int len(String ab) {
        char[] ac = ab.toCharArray();
        int i = 0, k = 0;

        for (i = 0, k = 0; ac[i] != '\0'; i++) {
            k++;
        }
        return k;
    }
}