Array of Objects in Java Programming
In this tutorial, you will learn about Array of Objects in java programming.
You will learn what are array of objects, how to create and use them, what is the advantage of using them in detail with example.
Source code for this video tutorial
Code for Student.java
package oops; public class Student { private String name; private int age; Student(){ name = "noname"; age = 1; } Student(String name, int age){ this.name = name; this.age = age; } void setNameAndAge(String name, int age){ this.name = name; this.age = age; } void introduce(){ System.out.println("hi i'm "+name+" and my age is "+age); } }
Code for Tutorials.java
package oops; public class Tutorials { public static void main(String[] args){ Student anil = new Student(); Student shreesh = new Student("Shreesh",25); Student anjali = new Student(); } }