Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class StaticProperty {
- public static class Person {
- static int staticProperty = 10;
- String name;
- public Person(String name) {
- this.name = name;
- }
- }
- public static void main(String[] args) {
- Person john = new Person("john");
- System.out.println(john.staticProperty); // 10
- john.staticProperty = 5;
- System.out.println(Person.staticProperty); // 5
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement