"main cannot access this.x as it is declared now" and "By declaring x as static, main can access this.x"
About Question enthuware.ocajp.i.v7.2.1343 :
Moderator: admin
-
- Posts: 3
- Joined: Thu Jan 01, 2015 1:14 pm
- Contact:
About Question enthuware.ocajp.i.v7.2.1343 :
Good day. I don't understand the difference between:
-
- Site Admin
- Posts: 10386
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1343 :
"main cannot access this.x as it is declared now" means the way x is declared currently in the given code, you cannot access it from main.
"By declaring x as static, main can access this.x" means if you make x static main can do this.x. : This is a wrong option because the statement is wrong. Even if you make x static, you cannot do this.x.
HTH,
Paul.
"By declaring x as static, main can access this.x" means if you make x static main can do this.x. : This is a wrong option because the statement is wrong. Even if you make x static, you cannot do this.x.
HTH,
Paul.
-
- Posts: 3
- Joined: Thu Jan 01, 2015 1:14 pm
- Contact:
-
- Posts: 1
- Joined: Tue Aug 16, 2016 3:04 am
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1343 :
Guys , I disagree with the correct answer.
As stated right now, it implies that there is a way (if you change the declaration of x) to access this.x from main.
Please let me know of your opinion
As stated right now, it implies that there is a way (if you change the declaration of x) to access this.x from main.
Please let me know of your opinion
-
- Site Admin
- Posts: 10386
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1343 :
No, there is no such implication. You just need to consider what is written in the option.
HTH,
Paul.
HTH,
Paul.
Who is online
Users browsing this forum: No registered users and 6 guests