Hi I'm sort of new to java so this may be an easy solution but I need to be able to tell if user input is a String or some other object and this does not seem to work:
public static void main(String[] args){
     Scanner sc = new Scanner(System.in);
     Object name;
     //have user enter their name 
     do{
        System.out.println("Please enter your name: ");
        name = sc.nextLine();
        if(name instanceof String){
            System.out.println(name);
            break;
        }else{
            System.out.println("Enter a String!");
            sc.next();
            }
    } while(true);
}
 
     
     
    