0
What if I don't declare a Variable of a specific data type as static and try to access it from a static method say main()?
9 Respostas
+ 3
every reference has it's own copy of non-static variable
Whereas static variables are shared
A cording to your program, reference variable e1,e2,and e3 has it's own copy of non-static variable 'a'
There will be only one copy of static variable 'b' which is shared among e1,e2,and e3
+ 3
Yes....because it's a non-static variable
+ 3
In this you are not getting your output because you are using short-circuit operator &&
Use & instead of && and you will get your desired output
https://www.sololearn.com/Discuss/1600030/?ref=app
+ 1
Do you know how post increment and pre increment operator works?
+ 1
Thanks a lot.....
0
That means value of a gets incremented by 1 only once no matter how many times I access the variable....
0
Please explain this one to me.....I am thoroughly confused....Wish I had justified the output by modifying the code but I didn’t.....
0
Yup....definitely.......pre increment operator gets the value of the variable incremented first and then assigns it to the variable.....post increment operator does the opposite.....