how to convert text to string

I want to convert a UI Text to a string, so I can see if it is a correct answer.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class car : MonoBehaviour {

	public GameObject fordimage;
	public GameObject chevyimage;
	public GameObject jaguarimage;
	public GameObject mazdaimage;
	public GameObject toyotaimage;
	public int counter;
	public Text answer;
	public string correctanswer;
	public Button nextbutton;

	void Start () 
	{
		correctanswer = ("");
		fordimage.SetActive (false);
		chevyimage.SetActive (false);
		jaguarimage.SetActive (false);
		mazdaimage.SetActive (false);
		toyotaimage.SetActive (false);
		counter = Random.Range (1,5);
		nextbutton.interactable = false;
		print (counter);
	}


	void Update () 
	{
		if (answer.ToString() == correctanswer) //error on this line
		{
			nextbutton.interactable = true;
		}


		if (counter == 1) 
		{
			fordimage.SetActive (true);
			correctanswer = ("ford");
		}
		else 
		{
			fordimage.SetActive (false);
		}
		if (counter == 2) 
		{
			chevyimage.SetActive (true);
			correctanswer = ("chevy");
		} 
		else 
		{
			chevyimage.SetActive (false);
		}
		if (counter == 3)
		{
			jaguarimage.SetActive (true);
			correctanswer = ("jaguar");
		}
		else
		{
			jaguarimage.SetActive (false);
		}
		if (counter == 4)
		{
			mazdaimage.SetActive (true);
			correctanswer = ("mazda");
		}
		else
		{
			mazdaimage.SetActive (false);
		}
		if (counter == 5)
		{
			toyotaimage.SetActive (true);
			correctanswer = ("toyota");
		}
		else
		{
			toyotaimage.SetActive (false);
		}
	}
}

answer.text is how you access the text component of a text game object

@smkmth is correct, use answer.text. Here is the Unity Documentation for this: https://docs.unity3d.com/ScriptReference/UI.Text-text.html

So I have a input field, and I am trying to get the text that the player inputs.

Found the Answer:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class car : MonoBehaviour {

	public GameObject fordimage;
	public GameObject chevyimage;
	public GameObject jaguarimage;
	public GameObject mazdaimage;
	public GameObject toyotaimage;
	public int counter;
	public InputField answer;
	public string correctanswer;
	public Button nextbutton;
	public Button pausebutton;

	void Start () 
	{
		nextbutton.interactable = false;
		correctanswer = ("None");
		fordimage.SetActive (false);
		chevyimage.SetActive (false);
		jaguarimage.SetActive (false);
		mazdaimage.SetActive (false);
		toyotaimage.SetActive (false);
		counter = Random.Range (1,6);
		print (counter);
		Button next1 = nextbutton.GetComponent<Button> ();
		next1.onClick.AddListener (clicked);
	}

	void clicked ()
	{
		correctanswer = ("None");
		counter = Random.Range (1,6);
		nextbutton.interactable = false;
	}

	void Update () 
	{
		if (answer.text == correctanswer)
		{
			nextbutton.interactable = true;
		}

		if (counter == 1) 
		{
			fordimage.SetActive (true);
			correctanswer = ("ford");
		}
		else 
		{
			fordimage.SetActive (false);
		}
		if (counter == 2) 
		{
			chevyimage.SetActive (true);
			correctanswer = ("chevy");
		} 
		else 
		{
			chevyimage.SetActive (false);
		}
		if (counter == 3)
		{
			jaguarimage.SetActive (true);
			correctanswer = ("jaguar");
		}
		else
		{
			jaguarimage.SetActive (false);
		}
		if (counter == 4)
		{
			mazdaimage.SetActive (true);
			correctanswer = ("mazda");
		}
		else
		{
			mazdaimage.SetActive (false);
		}
		if (counter == 5)
		{
			toyotaimage.SetActive (true);
			correctanswer = ("toyota");
		}
		else
		{
			toyotaimage.SetActive (false);
		}
	}
}