Powered by Blogger.
Showing posts with label example of homogeneous. Show all posts
Showing posts with label example of homogeneous. Show all posts

Java Code | Definition of Homogeneous Collection in Java Program

Definition of Homogeneous Collection:-

Homogeneous collection is the collection of objects that have a common class.

 Example of Homogeneous Collection:-

 public class TestHomogeneous{
   public static void main(String[]args){
      TestHomogeneous[] arr = new TestHomogeneous[3];
      arr[0] = new TestHomogeneous();
      arr[1] = new TestHomogeneous();
      arr[2] = new TestHomogeneous();
   }
 }


Homogeneous Collection:-

1. A collection of objects with the same dynamic type. Arrays are the most common homogeneous collection objects. See heterogeneous collection.

2. Browse Related Terms: array, autoboxing, base type, casting, dynamic type, heterogeneous collection, main method, return type.

Homogeneous Collection Programs:-

 class Man{
    public void fly(){
    System.out.print(DIP);
  }
 }
 public class A{
    public static void main(String[]args){
       Man[] arr = new Man[3];
       arr[0] = new Man();
       arr[1] = new Man();
       arr[2] = new Man();
   }
 }