System.out.println("haha"+"\n"+"xixi" );
执行这句代码应该得到:
haha
xixi
然而执行这段代码System.out.println("haha"+"\r"+"xixi" );
同样得到了
haha
xixi
我觉得第二句应该只得到xixi,因为回车到本行首把haha覆盖了,
我不明白什么原因,我用的是Jcreator ,我也看了关于\r和\n的
区别文章了,看明白了,可一动手发现还是没明白,希望大家帮帮小弟
先谢过了
执行这句代码应该得到:
haha
xixi
然而执行这段代码System.out.println("haha"+"\r"+"xixi" );
同样得到了
haha
xixi
我觉得第二句应该只得到xixi,因为回车到本行首把haha覆盖了,
我不明白什么原因,我用的是Jcreator ,我也看了关于\r和\n的
区别文章了,看明白了,可一动手发现还是没明白,希望大家帮帮小弟
先谢过了
输出的就是xixi
------- ----- --- ------ -----
000 000 000 00000000 NUL (Null char.)
001 001 001 00000001 SOH (Start of Header)
002 002 002 00000010 STX (Start of Text)
003 003 003 00000011 ETX (End of Text)
004 004 004 00000100 EOT (End of Transmission)
005 005 005 00000101 ENQ (Enquiry)
006 006 006 00000110 ACK (Acknowledgment)
007 007 007 00000111 BEL (Bell)
008 010 008 00001000 BS (Backspace)
009 011 009 00001001 HT (Horizontal Tab)
010 012 00A 00001010 LF (Line Feed)
011 013 00B 00001011 VT (Vertical Tab)
012 014 00C 00001100 FF (Form Feed)
013 015 00D 00001101 CR (Carriage Return)
014 016 00E 00001110 SO (Shift Out)
015 017 00F 00001111 SI (Shift In)
016 020 010 00010000 DLE (Data Link Escape)
017 021 011 00010001 DC1 (XON) (Device Control 1)
018 022 012 00010010 DC2 (Device Control 2)
019 023 013 00010011 DC3 (XOFF)(Device Control 3)
020 024 014 00010100 DC4 (Device Control 4)
021 025 015 00010101 NAK (Negative Acknowledgement)
022 026 016 00010110 SYN (Synchronous Idle)
023 027 017 00010111 ETB (End of Trans. Block)
024 030 018 00011000 CAN (Cancel)
025 031 019 00011001 EM (End of Medium)
026 032 01A 00011010 SUB (Substitute)
027 033 01B 00011011 ESC (Escape)
028 034 01C 00011100 FS (File Separator)
029 035 01D 00011101 GS (Group Separator)
030 036 01E 00011110 RS (Request to Send)(Record Separator)
031 037 01F 00011111 US (Unit Separator)
032 040 020 00100000 SP (Space)
----
NUL (null)
SOH (start of heading)
STX (start of text)
ETX (end of text)
EOT (end of transmission) - Not the same as ETB
ENQ (enquiry)
ACK (acknowledge)
BEL (bell) - Caused teletype machines to ring a bell. Causes a beep
in many common terminals and terminal emulation programs.
BS (backspace) - Moves the cursor (or print head) move backwards (left)
one space.
TAB (horizontal tab) - Moves the cursor (or print head) right to the next
tab stop. The spacing of tab stops is dependent
on the output device, but is often either 8 or 10.
LF (NL line feed, new line) - Moves the cursor (or print head) to a new
line. On Unix systems, moves to a new line
AND all the way to the left.
VT (vertical tab)
FF (form feed) - Advances paper to the top of the next page (if the
output device is a printer).
CR (carriage return) - Moves the cursor all the way to the left, but does
not advance to the next line.
SO (shift out) - Switches output device to alternate character set.
SI (shift in) - Switches output device back to default character set.
DLE (data link escape)
DC1 (device control 1)
DC2 (device control 2)
DC3 (device control 3)
DC4 (device control 4)
NAK (negative acknowledge)
SYN (synchronous idle)
ETB (end of transmission block) - Not the same as EOT
CAN (cancel)
EM (end of medium)
SUB (substitute)
ESC (escape)
FS (file separator)
GS (group separator)
RS (record separator)
US (unit separator) ----
转义字符 描述。\ddd 1到3位8进制数据所表示的字符(ddd)\uxxxx 1到4位16进制数所表示的字符(xxxx)\’ 单引号字符。\\ 反斜杠字符。\r 回车。\n 换行。\f 走纸换页。\t 横向跳格。\b 退格。
二楼,我用jcreator System.out.println("haha"+"\r"+"xixi" );
输出的就是xixi???
我的怎么就不行啊 头疼
呵呵,看来还是常用console安全,以前图省事钩了capture outpu
总有奇怪的反应···