About Question enthuware.ocajp.i.v8.2.1004 :
Moderator: admin
-
- Posts: 32
- Joined: Fri Oct 16, 2015 4:33 am
- Contact:
About Question enthuware.ocajp.i.v8.2.1004 :
1) The first underlined statement:
We can also declare local variables in instance initializer and static initializer blocks, or in Constructors too. It may be written as this:
"A local variable (aka automatic variable) means a variable declared in a method or block of code".
2) The second underlined statement:
It is a bit confused. If we apply static to instance variable so it will not be instance variable, however it will be class variable.
-
- Site Admin
- Posts: 10062
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.1004 :
1. Fixed.
2. Yes, if you apply static to an instance field, it won't remain instance field after that. But the fact still remains that you can apply static to an instance variable.
HTH,
Paul.
2. Yes, if you apply static to an instance field, it won't remain instance field after that. But the fact still remains that you can apply static to an instance variable.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 6
- Joined: Fri Jun 03, 2022 9:14 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.1004 :
What is "final" local variable good for?
-
- Site Admin
- Posts: 10062
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.1004 :
It is a good to convey the intention of the programmer that the value of that variable is not going to change. Compiler can also apply better optimization techniques if a variable is final. So basically, applying final to a local variable gives the same benefits as applying final to any other variable.
If you like our products and services, please help us by posting your review here.
-
- Posts: 6
- Joined: Fri Jun 03, 2022 9:14 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.1004 :
Thank you for your reply. May I ask as for this kind of question,is the purpose of it is to test the logical thinking of candidate? I don't see the study guide putting emphasize on it. What matter is the scoping of the variable. I might have missed something.
-
- Site Admin
- Posts: 10062
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.1004 :
Unfortunately, it is true to a great extent that the exam tests more on the language features, APIs, and syntax than good development practices. Since our goal is to help the candidates pass the exam, we try to keep our questions close to what one can expect in the real exam.
But it is alright, there are pros and cons for every thing. So, I would suggest you to not worry about the style of the exam and just focus on learning what is required. Based on our experience, we think you will definitely be benefited in the long run by studying for the exam.
But it is alright, there are pros and cons for every thing. So, I would suggest you to not worry about the style of the exam and just focus on learning what is required. Based on our experience, we think you will definitely be benefited in the long run by studying for the exam.
If you like our products and services, please help us by posting your review here.
-
- Posts: 6
- Joined: Fri Jun 03, 2022 9:14 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.1004 :
Thank you very much
Who is online
Users browsing this forum: No registered users and 35 guests