Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

what is static setter and getter examples in java

public class DataHolder{
  private static String dataString;
  public static String getDataString(){
    synchronized(DataHolder.class){
      return DataHolder.dataString;
    }
  }

  public static void setString(String dataString){
    synchronized(DataHolder.class){
      DataHolder.dataString = dataString;
    }
  }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #static #setter #getter #examples #java
ADD COMMENT
Topic
Name
6+8 =