Java program to insert records using arraylist.
import java.util.*; class employee { emp e1=new emp(); static int limit; static Scanner s1=new Scanner(System.in); ArrayListmy_list=new ArrayList (); public static void main(String[] args) { System.out.println("WELCOME"); System.out.print("Enter the limit="); limit=s1.nextInt(); employee em=new employee(); for(int i=0;i //this program does not print different records as entered according to the limit.it displays only the value last entered. example- if i enter 1st record- riti 1 2900
enter 2nd record-abc 2 1200
then it displays-
abc 2 1200
abc 2 1200
kindly help me.
Replies
-
Anand TamariyaAdd following at the start of input():
e1 = new emp();
-
Rits rishi
i added your statment..but now it's displaying only 1 record & that too last one.Anand TamariyaAdd following at the start of input():
e1 = new emp();
-
rahul69
Now, in output function, instead of :Rits rishii added your statment..but now it's displaying only 1 record & that too last one.
int j=1
inside the for loop, write
int j=0
๐ -
Rits rishi
THANK YOU SO MUCH.....๐๐๐rahul69Now, in output function, instead of :
inside the for loop, write
๐ -
Rits rishi
THANK YOU SO MUCH...๐ ๐๐rahul69Now, in output function, instead of :
inside the for loop, write
๐ -
rahul69
Ur Welcome ๐Rits rishiTHANK YOU SO MUCH...๐ ๐๐ -
simplycoder#-Link-Snipped-# : I would advise you to get your concepts cleared in this.
Knowing how arraylist works and why you have to create a new instance every time to add into it would be of a great help. -
Rits rishi
i know..n i am trying my best to achieve perfection..can u give me some programs regarding arraylist that i can practice.??๐ i'll post my answers here..it would be great help from your side..as i am having test on monday & topic is "arraylist".simplycoder#-Link-Snipped-# : I would advise you to get your concepts cleared in this.
Knowing how arraylist works and why you have to create a new instance every time to add into it would be of a great help.
please start from easy ones to complex ones..so that i can build up my confidence..๐ -
simplycoder
Ok,Rits rishii know..n i am trying my best to achieve perfection..can u give me some programs regarding arraylist that i can practice.??๐ i'll post my answers here..it would be great help from your side..as i am having test on monday & topic is "arraylist".
please start from easy ones to complex ones..so that i can build up my confidence..๐
1)WAP which will take input from user of n integers and print it.
2)WAP which will print the above list in ascending and descending order.
3)WAP which will take the input as a string arraylist.
"I love CE . I am proud to be a CEan ."
Print the count first.
Remove '.' character from the above sentence and print the list and the count.
4)Convert all the characters to lower case and upper case from the above question.
5)Reverse the sentence along but donot change the order of the alphabets in the word.
(exected output : . CEan a be to proud am I . CE love I).
6**)Calculate 100! using arrayList.
first five are pretty simple. Don't be demoralized if you don't get the 6th one
You are reading an archived discussion.
Related Posts
Do anti viruses really work????????????
How to judge the best among the various anti viruses available in the market?
Beebone Virus is creating havoc in the Indian computer networks, reports ET. The newly discovered virus has infected Indian cyberspace and the security experts have issued an alert to all...
Free webinar on23rd July 2013:
https://www.globalspec.com/events/eventregister?eventId=386
As per the norms of KYCE once a KYCE is ready we must put out a teaser to commemorate
Well as many people asked It is KYCEan Abhishek Rawal this...
I was on the bus to the train station earlier today, and I noticed a small ford hatchback with large Nokia decals buzzing passed. What caught my attention was the...