Help me in solving SYNJ4V2 problem

My issue

explain the reason

My code

class CodeChef
{
	public static void main (String args [])
	{
		System.out.println( 3 + 4 );
		System.out.println( 2 + 1 );
		
	}
}

Learning course: Learn Java
Problem Link: CodeChef: Practical coding for everyone

@smujeeb7860
U have to print answers without space in the same line.
Like this:-

class CodeChef
{
	public static void main (String[] args)
	{
		System.out.print(3 + 4);
		System.out.print(2 + 1);
	}
}

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.

@sora0
I know that i haven’t asked for it :slight_smile:

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);
}
}