fork(11) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. class Person {
  8.  
  9. String name;
  10. int age;
  11.  
  12. public Person (int age, String name) {
  13. this.age = age;
  14. this.name = name;
  15. }
  16. }
  17.  
  18. /* Name of the class has to be "Main" only if the class is public. */
  19. class Ideone
  20. {
  21. public static void main (String[] args) throws java.lang.Exception
  22. {
  23. Person person = new Person(25, "John");
  24. System.out.println(person.toString());
  25. }
  26. }
Success #stdin #stdout 0.09s 320576KB
stdin
Standard input is empty
stdout
Person@52e922