This week's book giveaways are in the Scala and Android forums.
We're giving away four copies each of Machine Learning Systems: Designs that scale and Xamarin in Action: Creating native cross-platform mobile apps and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how do i retrieve info from array?  RSS feed

 
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
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please try this program.


 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your doubt is not clear. Can you explain what you want to acheive.
 
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
 
Marshal
Posts: 59101
180
  • 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
 
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
Marshal
Posts: 59101
180
  • 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
Marshal
Posts: 59101
180
  • 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
Marshal
Posts: 59101
180
  • 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.
 
Do you pee on your compost? Does this tiny ad?
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!