Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how do i retrieve info from array?

 
Abhradeep Banerjee
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do I retrive info I stored in an array.. from another class

Database.java

Car.java

mainmethod.java
 
Amarnath Pandi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please try this program.


 
xsunil kumar
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your doubt is not clear. Can you explain what you want to acheive.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
want to creat an Object[Car] Array? your question is not Clear. need more detail
 
Campbell Ritchie
Sheriff
Pie
Posts: 49447
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Those ways of using arrays look inefficient. If you know how to, you would find a Map a much better way to search for Car objects.
 
Abhradeep Banerjee
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what do you mean by MAP??
actually wanted an explaination or example how to do it
anyways thanks I will try and figure out what you wrote for the codes
 
John de Michele
Rancher
Posts: 600
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abhradeep:

You might want to look in the javadoc for the Map interface.

John.
 
Abhradeep Banerjee
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javadoc???
what is that??
 
John de Michele
Rancher
Posts: 600
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abhradeep:

Here's the link for Map.

John.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49447
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But you might find the Java™ Tutorials section which has Map in easier to read.
 
Abhradeep Banerjee
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
got a few doubts in the code you have given me

package carModel; <== what does this do?
for(String car : CarList) <= dont understand this as far as i have learnt for loop is : for( i=0; i<10; i++)

return myDatabase.findCarByModel(this.make); //what is this.make for
 
Amarnath Pandi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Abhradeep,

After seeing your replies, I'd like to recommend you to go through the Java Tutorials. All the Best




 
Campbell Ritchie
Sheriff
Pie
Posts: 49447
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you don't understand package names, you can probably omit them.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49447
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amarnath Pandi wrote:. . . I'd like to recommend you to go through the Java Tutorials. All the Best
If you find the section about "the for statement" you will find the new form of the for loop in the same section.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic