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
NoSQL Data models: key-value Aggregate model. key or id is used to get the data. Lookup is based on the key. document Aggre...
-
Database scaling Horizontal scaling is ensured by adding concurrent machines that will handle more requests. Path1: The requests will...
-
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...
-
Personalization concepts: There are many categories of web personalization including Behavioral Contextual Technical Historic data Collabora...
No comments:
Post a Comment