article

Friday, June 28, 2019

How to Download Install NetBeans IDE 8.0.2 and create a project and run simple program

How to Download Install NetBeans IDE 8.0.2 and create a project and run simple program

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);
    }
    
}

Related Post