In java there are two types to print output print and println. In this problem you have use println which print the output of the next command on next line but in the problem it is given that you have to print on the same line thus you should use print instead of println.
In this problem you have to print both output in same line by using print insted of println because it is used to print output in new line (ln means new line) eg.
class CodeChef
{
public static void main (String args)
{
// update your code here
System.out.print(3+4);
System.out.print(2+1);
}
}
.3 and 4 are literal values java compiler recognizes the 3 and 4 as integers and knows how to add them together. You can use literal values in arithmetic operations, and the result will be computed at compile-time and then printed.
The output will be 73 for your code.
But if you want to print as follows:
7
3
use the below code
class CodeChef
{
public static void main (String args)
{
System.out.println(3 + 4);
System.out.println(2 + 1);
}
}