public class Test { static char a[] = {'a',' ', 'b',' ','c',' ', ' ', ' ', 'd'}; public static void displayNonWhiteSpaces() { for(int i=0; i<a.length; i++) { if(a[i] != ' ') { System.out.println(a[i]); } } } public static void removeWhiteSpaces() { int k=0; for(int i=0; i<a.length; i++) { if(a[i] != ' ') { a[k++] = a[i]; if(k<i) { a[i] = ' '; } } } System.out.println("Length " + a.length); for(int i=0; i<a.length; i++) { System.out.print("\n" + a[i]); } } public static void main(String args[]) { displayNonWhiteSpaces(); removeWhiteSpaces(); } }
White Spaces
Hello World
Subscribe to:
Post Comments (Atom)
NoSQL
This one is reviewed but I need to delete its copy from hubpages or somewhere NoSQL Data models: key-value Aggregate model. key or i...
-
What are High and low fidelity wireframes? Low-Fidelity wireframes are just simple drawings of how the screen will look like. High-Fi...
-
How would you handle non-productive developers or team-members? Align big lofty goals with their personal goals. If not, incentivize them ...
-
Why should we hire you? To answer this questions, specify why are you a good fit to the role and the company. If you doing some volunteer...
No comments:
Post a Comment