Friday, February 24, 2012

program cek kata

import jeliot.io.*;

public class Cek_Kata {

public static boolean cek() {
    String kata1 = "Algo";
    char huruf = 'g';
    int len = kata1.length();

    for (int i=0; i< len; i++) {
        if (kata1.charAt(i) == huruf) {
            return true;
        }
    }
    return false;
}

    public static void main() {
        if (cek())
            System.out.print("Ada");
        else System.out.print("Tidak Ada");
    }
}

No comments:

Post a Comment