Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

what is static setter and getter examples in java

class SomeClass {
    private static Data data;

    public static void setData(String data) {
        data = new Data(data);
    }

    public static String getData() {
        return data.toString();
    }
}

class Data {
    private String data;

    public Data(String data) {
        this.data = data;
    }

    public String toString() {
        return data;
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #static #setter #getter #examples #java
ADD COMMENT
Topic
Name
5+8 =