java转义字符escape_java转义字符(Java escape character).doc

java转义字符(Java escape character)

java转义字符(Java escape character)

Escape the escape character in 17:40JAVA 2009-08-12 characters in JAVA:

The 1. octal escape sequence: \ + 1 to 3 5 numbers;'\000'~'\377'

\0: empty character

2.Unicode escape character: \u + four sixteen hexadecimal numbers; 0~65535

\u0000: empty character

3. special characters: 3

"Double quotes:

'single quotes:

A backslash \ \:

4. control characters: 5

'singlequotedcharacter

The backslash character \ \

Enter \r

\n wrap

\f paper page

\t horizontal jump

\b backspace

The escape: ==> u002E.

The dollar sign: $==> u0024

The escape symbol: u005E ^ ==> involution

Escape left brace: {==> u007B

Escape the left bracket: ==> [u005B

The left parenthesis: ==> (u0028

A: | ==> escape u007C

Escape right parenthesis: ==>) u0029

An asterisk * ==> escape: u002A

Plus: u002B + ==> escape

Mark: u003F ==> escape?

Escape backslash: ==> u005C

======================================================================

The following program uses two Unicode escape character, they are used to represent the Unicode character hexadecimal code sixteen. So, what will the program print?

Java code

Public class EscapeRout{

Public static void main (String[] args) {

/ / \u0022 is a Unicode escape double quotes

System.out.println ("a\u0022.length ()

+\u0022b (.Length));

}

}

Public class EscapeRout{

Public static void main (String[] args) {

/ / \u0022 is a Unicode escape double quotes

System.out.println ("a\u0022.length ()

+\u0022b (.Length));

}

}

On a very superficial analysis of the program will think it should print out the 26, because in the two double quotes "(a\u0022.length) a total of 26 characters between the string +\u0022b" logo.

A little further analysis point that the program should print 16, because the two Unicode escape character in each source file need to use 6 characters to say, but they only said a character in a string. Therefore, this should be the shorter string of 10 characters than it looks. If you run this program, you will find things are not so. This p

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值