# Write a class named Accumulator containing: An instance variable named sum of type integer, initialized to 0. A method named getSum that returns the value of sum. A method named add that accepts an integer parameter. The value of sum is increased by the value of the parameter.

### CHALLENGE:

Write a class named Accumulator containing:
An instance variable named sum of type integer, initialized to 0.
A method named getSum that returns the value of sum.
A method named add that accepts an integer parameter. The value of sum is increased by the value of the parameter.

### SOLUTION:

```public class Accumulator{
private int sum = 0;
public int getSum(){
return sum;
}
{"ft_lang_label":"__label__en","ft_lang_prob":0.762113,"math_prob":0.8053992,"size":496,"snap":"2021-43-2021-49","text_gpt3_token_len":114,"char_repetition_ratio":0.12195122,"word_repetition_ratio":0.0,"special_character_ratio":0.22782259,"punctuation_ratio":0.1368421,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9966629,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-10-21T22:21:20Z\",\"WARC-Record-ID\":\"<urn:uuid:4c7fde69-a8cc-449f-88c6-88f6140d2833>\",\"Content-Length\":\"66672\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:d81fb510-a3ae-4ff1-8fec-0461bce05e11>\",\"WARC-Concurrent-To\":\"<urn:uuid:e628ca9f-c365-49e3-9195-9c4b163952ff>\",\"WARC-IP-Address\":\"172.67.153.157\",\"WARC-Target-URI\":\"https://matthew.maennche.com/2014/06/write-class-named-accumulator-containing-instance-variable-named-sum-type-integer-initialized-0-method-named-getsum-returns-value-sum-method-named-add-accepts/\",\"WARC-Payload-Digest\":\"sha1:UXOTLS62YQU3AUT4PRIK34FUBO7WTNGK\",\"WARC-Block-Digest\":\"sha1:24HZHPUW4CIMSYXIDBHYBZK2JH4V33DP\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-43/CC-MAIN-2021-43_segments_1634323585441.99_warc_CC-MAIN-20211021195527-20211021225527-00056.warc.gz\"}"}