fork(1) download
  1. class Ideone{
  2. public static final String DEFAULT_FIELD_VALUE = "example";
  3. private String field; // to ensure encapsulation, all attributes should be private
  4.  
  5. public Ideone() {
  6. this(DEFAULT_FIELD_VALUE);
  7. }
  8.  
  9. public Ideone(String field) {
  10. this.field = field;
  11. }
  12.  
  13. public String getField() {
  14. return this.field;
  15. }
  16.  
  17. public static void main(String[] args) {
  18. System.out.println(new Ideone().getField().equals("example"));
  19. }
  20. }
Success #stdin #stdout 0.09s 27776KB
stdin
Standard input is empty
stdout
true