aspose file tools*
The moose likes Beginning Java and the fly likes how do i retrieve info from array? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how do i retrieve info from array?" Watch "how do i retrieve info from array?" New topic
Author

how do i retrieve info from array?

Abhradeep Banerjee
Ranch Hand

Joined: Dec 09, 2009
Posts: 71
how do I retrive info I stored in an array.. from another class

Database.java

Car.java

mainmethod.java
Amarnath Pandi
Greenhorn

Joined: Dec 04, 2009
Posts: 9
Please try this program.


xsunil kumar
Ranch Hand

Joined: Dec 14, 2009
Posts: 129
Your doubt is not clear. Can you explain what you want to acheive.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

want to creat an Object[Car] Array? your question is not Clear. need more detail
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36508
    
  16
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

Joined: Dec 09, 2009
Posts: 71
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

Joined: Mar 09, 2009
Posts: 600
Abhradeep:

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

John.
Abhradeep Banerjee
Ranch Hand

Joined: Dec 09, 2009
Posts: 71
javadoc???
what is that??
John de Michele
Rancher

Joined: Mar 09, 2009
Posts: 600
Abhradeep:

Here's the link for Map.

John.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36508
    
  16
But you might find the Java™ Tutorials section which has Map in easier to read.
Abhradeep Banerjee
Ranch Hand

Joined: Dec 09, 2009
Posts: 71
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

Joined: Dec 04, 2009
Posts: 9
Hello Abhradeep,

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




Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36508
    
  16
if you don't understand package names, you can probably omit them.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36508
    
  16
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.
 
Consider Paul's rocket mass heater.
 
subject: how do i retrieve info from array?
 
Similar Threads
array and setmethod
.get method data from an array using simple IO
comparing using arrays in java
err get and set methods and scanner class / JOptionPane
Car Inventory Problems