0

Where to use the static

21st Mar 2018, 3:48 PM
Mobassir Alam
Mobassir Alam - avatar
3 Réponses
+ 13
static for a method is used so that U don't need to create an object of a class to access that method . https://www.sololearn.com/learn/Java/2159/?ref=app 👉have look at my code , might it'll solve all doubts https://code.sololearn.com/cvfs7727ltDG/?ref=app
21st Mar 2018, 5:35 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 2
Static is used in a class, if you want that variable to be global. It means that variable will have the same value in every program. Use it if you want that variable to be associated with the class, but not tied to a single instance.
21st Mar 2018, 4:06 PM
Ariela
Ariela - avatar
0
thanks
22nd Mar 2018, 3:18 PM
Mobassir Alam
Mobassir Alam - avatar