How to create dynamic number of objects in java
i am a beginner to java.i just need to know how to create a number of objects that a user can give it..for example
how many employees working in ur company?
user need to give like 5
and my program should create 5 objects with seperate variables like firstname,lastname..etc.,
pls give me some solutions to it!!!!
waiting for ur reply
Re: How to create dynamic number of objects in java
You'll want to use arrays, not separate variables. The names of variables are given when you type the name into the source program. Not very dynamic.
create 5 objects with seperate variables
With an array, you will use a loop to fill the array with user input.