I have two string variables ticker and detail. I'm trying to print out the two strings in one line. It just wouldn't work. I've tried so many different ways of doing this. To exclude the possibility of an uninitialized string I tried printing them out in different lines ... this works.
This example works ... except that the output needs to be in one line.
System.out.println(ticker);
System.out.println(detail);
And the output is:
IWM
|0#0.0|0#0.0|0#-4252#386|
GLD
|0#0.0|0#0.0|0#-4704#818|
When I try to put the output into one line in any of many ways, I get only the ticker ... the detail string is just not printed ... not to console or to file. Here are some example code snippets that produce the same result:
Attempt 1:
System.out.println(ticker.concat(detail));
Attempt 2:
System.out.println(ticker+detail);
Attempt 3:
StringBuffer sb = new StringBuffer();
sb.append(ticker);
sb.append(detail);
System.out.print(sb.toString());
Attempt 4:
System.out.print(ticker);
System.out.println(detail);
In all the above attempts, I get the following output ... as if the detail part is ignored:
GOLD
BBL
SI
What could be causing these symptoms? Is there a way to get the two strings printed in one line?
tickeranddetailStrings? You could debug the code and get the text there...