View Single Post
  #1 (permalink)  
Old 05-05-2008, 08:17 PM
Gakusei Gakusei is offline
Member
 
Join Date: May 2008
Posts: 3
Gakusei is on a distinguished road
[SOLVED] \t not working correctly?
Hi everyone, I'm having a bit of trouble with "\t" for some reason.

This is what I'm trying to output:

Code:
N 10*N 100*N 1000*N 1 10 100 1000 2 20 200 2000 3 30 300 3000 4 40 400 4000 5 50 500 5000
My code works fine except that it doesn't put the tab doesn't show up.
Here is my code:

Code:
import javax.swing.JOptionPane; public class Ex6 { public static void main(String args[]) { String msg; msg = "N\t10*N\t100*N\t1000*N\n\n"; // \t doesn't seem to be working for some reason... for (int i = 1; i <= 5; i++) { msg += String.format("%d\t%d\t%d\t%d\n", i, i*10, i*100, i*1000); } JOptionPane.showMessageDialog(null, msg); } }
And this is what I get:

Code:
N10*N100*N1000*N 1101001000 2202002000 3303003000 4404004000 5505005000
Does anyone happen to know what the problem is here?
Reply With Quote
Sponsored Links