How can I use the int in the another script?

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


public class Quiz1 : MonoBehaviour
{
    [SerializeField] private TMP_Dropdown dropdown;

    public void OnChangedDropdown (int value)
    {
        public static int answer1 = dropdown.value + 1;        
        Debug.Log(answer1);
    }

}

I would like to use the value from the dropdown in the above script for other scripts. But I get an error and cannot use them. How should I deal with this?

You can’t declare a public static variable in a local scope. You must declare it outside of the function, in the class scope.

However, generally you should avoid static variables and instead use instance variables and serialized references. Static will work, but it adds a great amount of inflexibility due to the constraints of only allowing once instance of the member.