简体   繁体   English

如何在NetBeans IDE中的Java中的多行中编写长方法调用

[英]How to write a long method call in multiple lines in java in netbeans IDE

I have a code something like this. 我有这样的代码。

System.out.println(fxJobList.get(i) + " " + type.get(i) + " " + longiList.get(i) + " " + latList.get(i) + " " + duration.get(i) + " " + startTime.get(i), teamList.get(i));

To follow the coding convention, I want to limit the length of one line to 80 columns. 为了遵循编码约定,我想将一行的长度限制为80列。 But I don't know how to make a single function call in two lines. 但是我不知道如何在两行中进行单个函数调用。

I am new to netbeans IDE. 我是netbeans IDE的新手。 Can anybody suggest? 有人可以建议吗?

In formatting options (Options-> Java Code -> Formatting) there is category wrapping. 在格式选项(选项-> Java代码->格式)中,有类别换行。

You can control when the lines should be spitted to two lines. 您可以控制何时将线分割为两行。 To follow Java Code Conventions you'll probably have to use value 'If long'. 要遵循Java代码约定,您可能必须使用值'If long'。

You can put a line break pretty much anywhere (other than inside your String of course). 您可以在几乎任何地方(当然不是在String内)放置换行符。 I would recommend something structured like this to make it clear that there are two arguments being passed, and one of them is a long string concatenation: 我建议使用类似以下的结构,以明确说明传递了两个参数,其中一个是长字符串连接:

System.out.println(
  fxJobList.get(i) + " " + 
    type.get(i) + " " + 
    longiList.get(i) + " " + 
    latList.get(i) + " " + 
    duration.get(i) + " " + 
    startTime.get(i), 
  teamList.get(i)
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM