// This is the definition for a class of objects named MainActivity. Each object of this class

// contains a field named mTag and has two methods named onCreate and onDestroy.

public class MainActivity extends AppCompatActivity {

    // The following variable mTag is global because it was not created within the

    // curly braces of a method.

    String mTag = "MainActivity";

    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        // The following instruction declares (creates) a variable named textView. The variable

        // is local because it was declared within the curly braces of a method. The variable‚Äôs

        // scope (the set of instructions where its name can be mentioned) extends from its

        // declaration to the closing curly brace that ends the method.

        TextView textView = (TextView) findViewById(R.id.textView);

        textView.setText("Hello");

        Log.d(mTag, "onCreate");

    }

    @Override

    protected void onDestroy() {

        super.onDestroy();

        Log.d(mTag, "onDestroy");

    }

}