I am currently trying to write code that has a long character array. A requirement is that code should be at most 100 characters long.
For simplicity and readability in this question this requirement is 60 characters
e.g. The would fail
1 2 3 4 5 6 7
0123467890123467890123467890123467890123467890123467890123467890
private static String s= "dghjkfkfdhkhkjhdfkjhfdkjhdfdfdfddfdfkhd";
One solution is to use the +
operator i.e.
1 2 3 4 5 6 7
0123467890123467890123467890123467890123467890123467890123467890
private static String s = "dghjkfkfdhkhkjhdf" +
"kjhfdkjhdfdfdfddfdfkhd";
My gut feeling is that the operator will be executed at run time. Is this true and if so what overheads are incurred?
OR
Is there an alternative mechanism as in C where you can do?
char s[] = "fjhdfdkjhfk"
"kjfdhfkjdhkh";
This mechanism does not appear to work in Java