title: Make a String in java Global
body: <p>I am an Android developer and I have made a string for generating a random 6-digit OTP which is there in the <code>protected void onCreate(Bundle savedInstanceState) {</code>, the first thing in a java program.:</p>
  <pre><code>String otp = new DecimalFormat(&quot;000000&quot;).format(new Random().nextInt(999999));
  Toast.makeText(getApplicationContext(), &quot;Your OTP is &quot; + otp, Toast.LENGTH_SHORT).show();
  </code></pre>
  <p>I have another <code>public void</code> in my java program in which I have to call the OTP String but, I don't know how to do that.</p>
  <p>Any type of help will be appreciated.</p>