Program to define a class 'employee' with data members as empid, name and salary. Accept data for 5 objects using Array of objects and print it.
This program demonstrates you the array of objects. Array of object is the collection of objects of the same class. The given syntax will define an array of reference therefore assign object to individual reference in the array to declare the array of object. The syntax to define array of object is: <class-name> <array-name> [size]; For example, the following statement will define an array of object having size 6 references to the class Box . Box b[6]; For creating an array of objects (allocating memory) you have to write down the following statements for (int i=0; i<6; i++) { b[i] = new Box(); // Assigning object to individual reference in the array. } PROGRAM import java.util.Scanner; public class Employee { int empid; String name; float salary; public void getInput() { Scanner in = new Scanner(System.in); System.out.print("Enter the empid :: "); empid = in.nextInt(); System.out.print("Enter the name :: ");
Nice Blog...Waiting for Next Update..
ReplyDeletemobile app development companies in chennai
mobile app development company in chennai
ReplyDeleteAfter a long time, I read a very beautiful and very important article that I enjoyed reading. I have found that this article has many important points, I sincerely thank the admin of this website for sharing it. Best ecommerce website development company in noida service provider
Excellent article and with lots of information. I really learned a lot here. Do share more like this.
ReplyDeleteUiPath Training in Chennai
UiPath Online Training
It’s great to come across a blog every once in a while that isn’t the same out of date rehashed material. Fantastic read. Best wordpress website design services Services Provider
ReplyDeleteGreat job for publishing such a nice article. Your article isn’t only useful but it is additionally really informative. Thank you because you have been willing to share information with us. Android app development company Pune
ReplyDeleteExcellent blog, very nice to see your blog. Good content delivery.
ReplyDeleteUbs accounting Singapore
Sage UBS accounting singapore
Point of sale singapore