Question #283589

Write Al algaritham for the network administrator to help him find the number of data character that do not change position even after the data change

Expert's answer

public class Main {
    public static void main(String[] args) {
        String one = "fgsdkgjs'lfj423581-";
        String two = "fgdklsj[05923-5fsd";
        int notChanged = 0;
        for (int i = 0; i < Math.min(one.length(), two.length()); i++) {
            if (one.charAt(i) == two.charAt(i)) {
                notChanged++;
            }
        }
        System.out.println(notChanged);
    }
}
LATEST TUTORIALS
APPROVED BY CLIENTS