CanYouReadThis doubt in coding

import java.util.*;
public class Main {
public static void main(String args[]) {

Scanner scn = new Scanner(System.in);

        String str = scn.next();
        if(str.length()<=1000)
        {
	    CanYouReadThis(str);
        }
}
public static void CanYouReadThis(String str) {

       
        for(int i = 0;i < str.length();i++) {

            if(i != 0 && Character.isUpperCase(str.charAt(i))) {
                System.out.println();
            }

            System.out.print(str.charAt(i));
        }


    }

}
i write this code i know this is write code …but can you explain how it’s work because i don’t know …can u plz debug the code

@mayanktiwari6957 If you have written this code then you should be knowing how it is working bro, else how you are able to write it? Just debug it yourself with the sample input! Dry run it on paper, then only you will learn!

1 Like