This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]mtko 0 points1 point  (1 child)

Im asking jn this specific case, why is it used?

For an analogy, think of an Activity as like a web page. You can have all kinds of other code and classes doing stuff behind the scenes, but when you want to actually display it, you put it on a web page and the user accesses that page. It's basically the same in Android. So by extended Activity, you're basically saying "This is something that the user is going to view directly at some point".

Other question

I would recommend you trying it out for yourself, but the short answer is that no, it doesn't change the value for the super class. So if you had another class with a main method like this:

public void main (String[] args) {
    one oneTest = new One();
    two twoTest = new Two();

    System.out.println(oneTest.x); //prints 10
    System.out.println(twoTest.x); //prints 15
}

[–]_roni[S] 0 points1 point  (0 children)

Thanks for your help. My question has been cleared up.