如果你选择一种非标准的缩进风格,会有什么区别吗?
这是我经常看到的风格:
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
public class Test {
static public void main(String args[]) throws Exception {
FileInputStream fin = new FileInputStream("infile.txt");
FileOutputStream fout = new FileOutputStream("outfile.txt");
FileChannel inc = fin.getChannel();
FileChannel outc = fout.getChannel();
ByteBuffer bb = ByteBuffer.allocateDirect(1024);
while (true) {
int ret = inc.read(bb);
if (ret == -1)
break;
bb.flip();
outc.write(bb);
bb.clear();
}
}
}但我更喜欢从下一行开始的风格:
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
public class Test
{
static public void main(String args[]) throws Exception
{
FileInputStream fin = new FileInputStream("infile.txt");
FileOutputStream fout = new FileOutputStream("outfile.txt");
FileChannel inc = fin.getChannel();
FileChannel outc = fout.getChannel();
ByteBuffer bb = ByteBuffer.allocateDirect(1024);
while (true)
{
int ret = inc.read(bb);
if (ret == -1)
break;
bb.flip();
outc.write(bb);
bb.clear();
}
}
}--我发现它更容易阅读,但是如果我使用这种样式,我会遇到与其他人一起工作的问题吗?
https://stackoverflow.com/questions/3798482
复制相似问题