Suppose I have the following code:
double median = med(10.0, 12.0, 3.0); //method returns middle number as double
Now, I want to write a message stating the median. Can this be done using println(), like the following:
System.out.println("Your number was " + median);
Or must I use printf() with double values?
The reason I ask is because I have seen both practices online 1, but when I try using println() I get an error, unless i write:
System.out.println(median);
Hence, can you use println() to print out double values and strings, or must you use printf() for that purpose?