Java program for static variable and static method
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Program:
Output:
private static int cnt - is a private member for class StaticVar and it is static too, it means the variable cnt can not be accessed outside of the class (due to private) and it is allocated once (due to static).
getCounter() - is a static method, which is calling with class name Item.