fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. CustomObj o1 = new CustomObj(1, "object 1");
  13. CustomObj o2 = new CustomObj(1, "object 1");
  14. System.out.println(o1);
  15. System.out.println(o2);
  16. }
  17. }
  18.  
  19.  
  20. class CustomObj {
  21.  
  22. private int id;
  23. private String desc;
  24.  
  25. public CustomObj(int id, String desc) {
  26. this.id = id;
  27. this.desc = desc;
  28. }
  29.  
  30. public int getId() {
  31. return this.id;
  32. }
  33.  
  34. public String getDesc() {
  35. return this.desc;
  36. }
  37.  
  38. // @Override
  39. // public String toString() {
  40. // return this.desc;
  41. // }
  42. }
Success #stdin #stdout 0.06s 2841600KB
stdin
Standard input is empty
stdout
CustomObj@677327b6
CustomObj@14ae5a5