Test case wrong

one test case is showing wrong answer
CODE:
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int j=0;j<t;j++)
{
String str1 = sc.next();
String str2 = sc.next();

    for(int i=0;i<str1.length();i++)
	{
	if(str1.charAt(i)==str2.charAt(i))
	{
          System.out.print("0");
	}
	else
	      System.out.print("1");
	}
}

}
}

Hi @akshay9009,put system.out.println() after the inside for loop.

why do we need println? since we have to print in one line only ,can’t we use print?
Thanks

See for every test case you have to print ans in the new line but all your answers are getting mixed.
for(int i=0;i<str1.length();i++)
{
if(str1.charAt(i)==str2.charAt(i))
{
System.out.print(“0”);
}
else
System.out.print(“1”);
}
System.out.println();

here put the println statement.

Hi @akshay9009
As you are not responding to the thread, I am marking your doubt as resolved for now. Re-open it if required.

Please mark your doubts as resolved in your course’s “Ask Doubt” section, when your doubt is resolved.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.