JavaGodPeter's blog

By JavaGodPeter, 4 months ago, In English

COMS 1004 study notes ==================

Ch3 Encapsulation ------------------ c++ import java.util.*; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); Counter A = new Counter(); A.reset(); A.click(); A.click(); int c = A.getValue(); System.out.println(c); } public static class Counter{ private int value; public void click() { value = value + 1; } public int getValue() { return value; } public void reset() { value = 0; } } }

  • Vote: I like it
  • -3
  • Vote: I do not like it

»
4 months ago, # |
  Vote: I like it 0 Vote: I do not like it

columbia cs course materials leaked :rofl: