Expecting member declaration error

for this line I’m getting error public static final String TAG = “ActivityLifecycle”;
in Log.d : Unexpected tokens (use ‘;’ to separate expressions on the same line)

and Cannot access ‘TAG’: it is invisible (private in a supertype) in ‘AppCompatActivity’

Seems you are using Kotlin.So you need to define TAG in kotlin way:

And, applying the correct way to declare and assign a variable, your code segment should be like this:

class MainActivity : AppCompatActivity() {
    val TAG = "ActivityLifecycle"

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.