java中r是什么意思啊,在java中,\r回车是什么意思。任何人都可以给出一个小例子...

这篇博客解释了Java中` `(回车符)、` `(换行符)和` `(形式feed)的含义。` `在旧式打印机上用于返回到行首,` `则用于下一行,` `指示打印机开始新页。在现代应用中,` `和` `较少使用,` `是标准的文本文件行结束符。在不同系统中,如DOS/Windows使用` `,而*nix系统使用` `作为行结束符。
摘要由CSDN通过智能技术生成

what is the meaning \r carriage return and /f form feed in java. can any one give a small example,

and when we have to use this type of symbols

i dont know where to try this type of symbols

System.out.println("hello world \r rafter \n nafter \f fafter");

i don't know what is what in that

out put i got is

hello world

r-after

n-after f-after

i got \r as new line and \n for new line and \f a box appears for me

please explain \r and \f mean

解决方案

You rarely use either of them (in isolation) in modern applications.

\r (carriage return) is what it sounds like if you're familiar with old-fashioned manual typewriters: It moves the "carriage" (the roll the paper is fed through) back to the beginning of the line. On a terminal (or similar), it moves the output point back to the beginning of the line, without moving down a line (usually).

\f is (as you said) a formfeed, it tells old-fashioned printers to start a new page. In computer documents, it's sometimes used to indicate a page break.

Rounding things out, there's also line feed (aka "newline"): \n. This means "move down a line." In some terminals, it just moves down a line without doing a carriage return; on others, it does both.

\n (LF, newline) is the standard text file line break on *nix and derived operating systems. \r\n (CRLF) is the standard text file line break on DOS and Windows. Back in the day, \r (on its own) was the standard line break in text files on the Mac, prior to Mac OS X (which is *nix-derived).

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值