+ 1

Static in java.

After seeing so many example I can't understand static. Have any simple & easy reference or example? Please explain.

19th Apr 2018, 12:35 AM
ā“¤ā“ā“¢ā“œā“ā“”ā“£ ā“‘ā“žā“Ø
ā“¤ā“ā“¢ā“œā“ā“”ā“£ ā“‘ā“žā“Ø - avatar
2 Answers
+ 1
"In Java, a static member is a member of a class that isnā€™t associated with an instance of a class. Instead, the member belongs to the class itself. As a result, you can access the static member without first creating a class instance." http://www.dummies.com/programming/java/what-is-the-static-keyword-in-java/ Math.pow(4, 2) can be called without creating a Math object, because it's static. If that function wasn't static, you'd have to create a Math object first to call it.
19th Apr 2018, 12:41 AM
Emma
19th Apr 2018, 3:02 AM
Ipang