Comments (4)
In Java you declare a variable as final
when you want to assign its value only once, attempting to reassign it will throw an exception at compile time. You may have noticed constants have this modifier, as per local variables/parameters means "I won't modify this variable reference/value during the flow of this method", normally you don't need it and is up to the code style.
from iosched.
@eveliotc
Yes, the value/reference of this variable declared as 'final' can't be changed or modified during the flow of this method. But what I wonder is, you know exactly, during the flow of this method, the Context and the boolean are not modified either. So, what the difference is here if the 'final's are erased?
Indeed, if there is a local inner class defined inside the method, in which parameters are used or changed, the 'final' is necessary. But there is no local inner class inside this method, so I figure 'final's here are unnecessary, what do you think?
from iosched.
@LittlePanpc yep, in that particular snippet is unnecessary
from iosched.
@eveliotc
OK, thank you very much.
from iosched.
Related Issues (20)
- Project cannot be build due to JCenter / Bintray dependencies
- hi
- Code autocompletion does not work HOT 1
- Execution failed for task ':shared:kaptStagingKotlin'. HOT 2
- dependency introduction problem
- Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: HOT 4
- no com.google.dagger:hilt-android dependency was found HOT 1
- My Browsing...Way
- Gradle sync error when cloning and open the project on Android Studio
- java.lang.IllegalStateException: No instantiated fragment
- Android Studio Project Build Error
- Anti Pattern in Connectivity View
- After the first installation, exit app, and then start app, it will flash, will never be normal, unless I uninstall and reinstall, please tell me what to do?
- iosched app can't login in google and have error
- What's your problem
- That istanbul in der telekom, deiner phantasie madness IP der nΓ€he der lichtbringerin
- The first time
- C
- Kxkk
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iosched.