Results 1 to 5 of 5
Thread: How to increase whitespace?
- 08-07-2010, 10:55 AM #1
Member
- Join Date
- Jun 2010
- Posts
- 29
- Rep Power
- 0
- 08-07-2010, 11:44 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,397
- Blog Entries
- 7
- Rep Power
- 17
- 08-09-2010, 07:18 PM #3
Member
- Join Date
- Jun 2010
- Posts
- 29
- Rep Power
- 0
The code works to put one more space than a previous line.
import java.util.*;
public class Sbuilder
{
public static void main(String[] args)
{
Stack<String> stack = new Stack<String>();
String[] s ={"a","b","c","d","f"};
StringBuilder st = new StringBuilder();
for(int i=0;i<s.length;i++){
// System.out.print(st.insert(i, " "));
System.out.print(st.append(" ")+stack.push(s[i]));
System.out.println();
}
System.out.println(st);
}
}
However, how about for following result.
wanted Ouput:
a
" " b
" ",c
d
" " b
How it works? Any hint please???????????????????
- 08-09-2010, 07:26 PM #4
System.out.println("\t"+stack.push(s[i]));
System.out.printf(" "+stack.push(s[i]));Last edited by Sno; 08-09-2010 at 07:29 PM.
:rolleyes: ~ Sno ~ :rolleyes:
'-~ B.S. Computer Science ~-'
- 08-09-2010, 08:00 PM #5
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,397
- Blog Entries
- 7
- Rep Power
- 17
Similar Threads
-
javac on the Windows command line--whitespace in path name?
By mslate in forum New To JavaReplies: 2Last Post: 03-31-2010, 12:26 AM -
How increase dynamic array?
By artemff in forum New To JavaReplies: 5Last Post: 01-01-2010, 12:22 AM -
removing duplicate whitespace
By loki in forum New To JavaReplies: 1Last Post: 04-25-2009, 05:54 PM -
why the number will not increase?
By rayda in forum New To JavaReplies: 3Last Post: 03-16-2009, 05:47 AM -
Reproducing whitespace with DOM
By doofuslarge in forum XMLReplies: 1Last Post: 02-11-2009, 01:42 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks