Guest User

Untitled

a guest
Oct 17th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. /*
  2. * To change this template, choose Tools | Templates
  3. * and open the template in the editor.
  4. */
  5.  
  6. package TC;
  7.  
  8. import TC.Objects.Human;
  9.  
  10. /**
  11. *
  12. * @author Connerd
  13. */
  14. public class Main {
  15.  
  16. /**
  17. * @param args the command line arguments
  18. */
  19. public static void main(String[] args) {
  20. // TODO code application logic here
  21. Main M = new Main(args);
  22. }
  23.  
  24. public Main(String[] args) {
  25. Human Connor = new Human("Connor", 16); // Calls a new instance of
  26. // Human with the variables
  27. // "Connor" and 16.
  28.  
  29. log(Connor.getName()); // Logs Connor's instance of "Human"'s Name
  30.  
  31. Human Michael = new Human("Michael", 15);// Calls a new instance of
  32. // Human with the variables
  33. // "Michael" and 15.
  34.  
  35. log(Michael.getAge()); // Logs Michael's instance of "Human"'s Age
  36.  
  37. }
  38.  
  39. public void log(String msg) {
  40. System.out.println(msg);
  41. }
  42.  
  43. public void log(int msg) {
  44. System.out.println(msg);
  45. }
  46.  
  47. }
Add Comment
Please, Sign In to add comment