question about System.out.println
The following code does not work:
int value;
System.out.println ("The value is ", value);
However, it works if I break into:
int value;
System.out.println ("The value is ");
System.out.println (value);
1.· println can only output 1 thing at a time?
2.· where is this stated in the Javelin manual?· (I don't believe this is a restriction of Java).
Thanks.
int value;
System.out.println ("The value is ", value);
However, it works if I break into:
int value;
System.out.println ("The value is ");
System.out.println (value);
1.· println can only output 1 thing at a time?
2.· where is this stated in the Javelin manual?· (I don't believe this is a restriction of Java).
Thanks.
Comments
Open help, packages, java.lang
From Class summary, select System, then click out, then click PrintStream.
That lists all methods for System.out
Indeed, all these methods take only 1 argument.
regards peter
System.out.println ("The value is " + value); //I'm not sure if you need to cast the value to (int)
However that will use a lot more memory than if you put them on two lines as you have it now, because it will create a new string if you do it the one line way.