java


How to access an instance of object in ArrayList of type InnerClass from another class?


The outer-class is ==> Bank [which is singleton][the method (getTheOneBank())will return the singleton object.
The inner-class is ==> Account [has many instances like : id,moneyAmount,.....]
class Bank has an arrayList of type Account [private ArrayList accounts]
class Bank has a method of type arrayList to return (accounts).
How to access the (id) instance of object (Account) that in ArrayList (accounts) ,from another class let us say(the main class).
here is my code:
for (Bank.Account obj : Bank.getAccounts())
{
System.out.println(obj.id);
}
Bank bank = new Bank();
for (Bank.Account obj : bank.getAccounts())
{
System.out.println(obj.id);
}

Related Links

404 when creating Web Service with eclipse
Adding a GPS receiver to java code?
Dynamic class loading vs injection
Populate attribute in List of Objects in Java using Lambda
Asynchronous service with Spring boot
No protocol malformed URL Exception thrown at me when trying to parse an XML String
Read 3 selected item in the same time
how to use setter and getter in different functions?
Unable to download file from Google Drive using Java API
Sending and reading a 2D array using sockets Java
/Date(long + 1000)/ format
possible paths to the top of a staircase
What is the best way to implement search in Android?
What is <?> in java? [duplicate]
XML file in a Linux environment not showing the correct symbol
Hibernate Migration from 3 to 4 SerializableBlob Class Deprecated

Categories

HOME
openlayers
wso2-am
clips
webpack
debugging
netsuite
proxy
jsp-tags
google-oauth
angular-ui-bootstrap
ios-charts
slurm
python-unittest
facebook-php-sdk
zend-framework3
messages
event-handling
ibm-odm
caml
highlight.js
pythonanywhere
interop
scichart
custom-wordpress-pages
amazonsellercentral
wijmo
lcd
java-7
su
semantic-analysis
poltergeist
ejabberd-module
google-cloud-nl
lightswitch-2013
microsoft-chart-controls
tinymce-4
bosh
scorm2004
http-referer
wixsharp
main
bitbucket-pipelines
user-controls
s
qcombobox
galleria
scorm
xml-documentation
apache-fop
revapi
clean-architecture
datastax-startup
pebble-watch
sybase-asa
r-forge
pdfclown
iso8601
vtigercrm
crosswalk-runtime
abcpdf9
merge-conflict-resolution
plottable.js
fuzzy-search
gstreamer-0.10
actionbardrawertoggle
suffix-tree
rhino-servicebus
xpath-1.0
rtbkit
ios8-today-widget
jms2
lib.web.mvc
google-places
ruby-2.2
atk4
twirl
remobjects
kineticjs
cdt
android-imagebutton
rdtsc
markers
braille
pyhdf
c18
yui-compressor
sabredav
ocunit
free-variable
trusted
pysimplesoap
transactionscope
nsobject
heartbeat
hamachi
xdomainrequest
yetanotherforum
appendto
disclosure
sql-server-profiler
suppress
ncqrs
web-architecture
eqatec
rtml
misv

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App