Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

what is getter and setter ?

public class Computer
    {
        int ram;
        public int RAM 
        { 
             get 
             {
                  return ram;
             }
             set 
             {
                  ram = value; // value is a reserved word and it is a variable that holds the input that is given to ram ( like in the example below )
             }
        }
     }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #getter #setter
ADD COMMENT
Topic
Name
4+9 =