Tutorial.java
package tutorial; public class Tutorial { public static void main(String[] args) { // TODO code application logic here simple program that will just print out the numbers 1 to 5 for (int i = 1; i < 6; i++) { System.out.println(i); } Person p = new Person("Mike"); p.displayName(); } }
Person.java
package tutorial; public class Person { private String name; /** Create a new instance of person */ public Person(String n) { name = n; } //display the name public void displayName() { System.out.println(name); } }