Why constant is used in Bundle method

In the Bundle, why the key is constant? what is the benefit of using constant rather than write it directly in the code.
For example, why the following is used:

private static final String KEY_INDEX = "index";
.
.
public void onSaveInstanceState(Bundle savedInstanceState) {
        super.onSaveInstanceState(savedInstanceState);
        Log.i(KEY_INDEX, "onSaveInstanceState");
        savedInstanceState.putInt(KEY_INDEX, mCurrentIndex);

instead of:

public void onSaveInstanceState(Bundle savedInstanceState) {
        super.onSaveInstanceState(savedInstanceState);
        Log.i(KEY_INDEX, "onSaveInstanceState");
        savedInstanceState.putInt(index, mCurrentIndex);

What is the index variable? it is a string value or integer or boolean. No !

Bundle includes key-value pairs.The key is a string value.
So you can use that:

public void onSaveInstanceState(Bundle savedInstanceState) {
        super.onSaveInstanceState(savedInstanceState);
        Log.i(KEY_INDEX, "onSaveInstanceState");
        savedInstanceState.putInt( "blabla", mCurrentIndex);

also, you can define that first definition to above, and “final” means that doesn’t change. So “blabla” doesn’t change.
Because it is a key of value.

if (savedInstanceState != null) {
        // Restore value of members from saved state
        mCurrentIndex= savedInstanceState.getInt("blabla");
    }

Source Code

Thank you for the answer, it helps a lot!

So I understand now, it is good practice to use with a Bundle method key the “final” keyword to be consistent throughout the codes.