Help me in solving TWOSTR problem

My issue

for(int i=0;i<x.length()-1;i++)
{
if(x.chartAt(i)== ‘?’||y.charAt(i)==‘?’)
flag= true;
if(x.charAt(i)==y.charAt(i))
flag =true;
}
if(flag==true)
System.out.println(“Yes”);
else
System.out.println(“No”);
}

why this code is genrate compile time error

My code

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc= new Scanner(System.in);
		int t=sc.nextInt();
		while(t-->0)
		{
		    String x=sc.next();
		    String y=sc.next();
		    boolean flag=false;
		    for(int i=0;i<x.length()-1;i++)
		    {
		        if(x.chartAt(i)== '?'||y.charAt(i)=='?')
		        flag= true;
		        if(x.charAt(i)==y.charAt(i)) 
		        flag =true;
		    }
		    if(flag==true)
		    System.out.println("Yes");
		    else
		    System.out.println("No");
		}
	}
}

Learning course: Strings using Java
Problem Link: Chef and the Wildcard Matching Practice Problem in - CodeChef

@jaykumar009
plzz refer the following java solution

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
			// your code goes here
		Scanner sc=new Scanner(System.in);
		int T=sc.nextInt();
		while(T-->0){
		    String X=sc.next();
		    String Y=sc.next();
		    int x=X.length();
		    boolean flag=true;
		    for(int i=0;i<x;i++){
		      //  if((X.charAt(i)==Y.charAt(i)) && (X.charAt(i)>='a' && X.charAt(i)<='z')&& (Y.charAt(i)>='a' && Y.charAt(i)<='z'))flag=true;
		        if((X.charAt(i)!=Y.charAt(i)) && (X.charAt(i)!='?' && Y.charAt(i)!='?') )flag =false;
		    }
		    if(flag)System.out.println("Yes");
		    else System.out.println("No");
		}
	}
}