+ 10

Can someone please explain the word static

6th Oct 2017, 11:46 AM
Austin Oyugi
Austin Oyugi - avatar
3 Réponses
+ 8
@Uvaish thanks
6th Oct 2017, 12:16 PM
Austin Oyugi
Austin Oyugi - avatar
+ 3
The value of a static variable is stored in the class itself rather than in a particular instance of a class (object). That is, if you create two class objects with static variable, the value of the static variable for each object class will be the same anyway https://code.sololearn.com/c0OMpUUlGHJg/?ref=app
6th Oct 2017, 12:26 PM
Миу
Миу - avatar
0
how can u determine what this means public class Program { public static void main(String[] args) { mclass c1 = new mclass(); mclass c2 = new mclass(); c1.x = 5; System.out.println(c1.x); //Static variable of class mclass System.out.println(c2.x); // Static variable of class mclass c2.x = 41; System.out.println(c2.x); System.out.println(c1.x); } } public class mclass{ static int x; }
17th Sep 2018, 7:40 AM
Jennifer Lynn Doughten