Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Sentence {
- public static void main(String[] args) {
- String sentence = "I love Desi ";
- String reverse = "";
- char[] characters = sentence.toCharArray();
- char space =' ';
- int size = 1;
- for(char c : characters) {
- if(c == ' ') {
- size++;
- }
- }
- System.out.println(size);
- String[] array=new String[size];
- for(String t:array) {
- System.out.println(t);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement