| Author |
Passing arguments in multiple lines
|
Nich Aquilina
Greenhorn
Joined: Feb 05, 2007
Posts: 6
|
|
Hi, Is there any way to split code in more than one line? to avoid scrolling? This especiallyin constructor, for example:- Worker(String name, String firstName, String dateOfBirth, String........) Thanks Nich
|
 |
John Bartlett
Ranch Hand
Joined: Jan 25, 2006
Posts: 116
|
|
I am not entirely sure what you mean by this, but if you mean just to avoid horizontal scrolling then why not just put the next param on a new line? e.g. although if you mean knowing that you are going to be receiving multiple params of the same type, i.e. above, and you want to reduce the code, then couldnt you use a varargs e.g. Not sure if that is what you wanted but hope it helps, John [ February 06, 2007: Message edited by: John Bartlett ]
|
 |
Ilja Preuss
author
Sheriff
Joined: Jul 11, 2001
Posts: 14112
|
|
Java doesn't distinguish between new lines and other white space (outside of comments and String literals). That is, everywhere you can use a space character, you can also use a new line. Both of the following code snippets are totally valid Java code: Both aren't styles I would recommend, though...
|
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
|
 |
Nich Aquilina
Greenhorn
Joined: Feb 05, 2007
Posts: 6
|
|
Thanks guys, that was it. Not the extreme one but worked great. ManualWorker(String familyName, String firstName, String dateOfBirth, String employeeNumber, String dateOfFirstEmployment,
|
 |
Nich Aquilina
Greenhorn
Joined: Feb 05, 2007
Posts: 6
|
|
Thanks guys, that was it. worked great. ManualWorker(String familyName, String firstName, String dateOfBirth, String employeeNumber, String dateOfFirstEmployment) Nicholas
|
 |
 |
|
|
subject: Passing arguments in multiple lines
|
|
|