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

Loading a compiled class in Java and deserializing it's instance from a file
Can I use Dagger 2 with Java 7?
instantiate the recursively defined composite generic classes in java
Java log4j not working
PagerAdapter changed adapters content with notifying
last character not rotating correctly
Java: showInputDialog and ProcessBuilder
Concurrent read access on map structure without lock
Java Swing - Working with Threads
Using an IF statement based on a random event
JavaFX nullpointer exception when using new nodes
Why is Java's TargetDataLine.read() so slow?
Saving frequently used apps to shared preferences
Java 8: Type inference fails when mapping objects to method references [duplicate]
How to use onNewIntent() in AppCompatActivity?
Navigate back to the respective Fragment using up button

Categories

HOME
sendgrid
osgi
clips
mediawiki
push-notification
include
office365api
tesseract
framework7
filtering
cross-browser
blueprintjs
swagger-ui
paradox
cloudkit
session-variables
floating-action-button
rascal
fortumo
paging
arabic
kvc
zurb-foundation-6
claims-based-identity
java-7
semantic-analysis
facebook-access-token
user-interaction
uninstall
bluestacks
fabric8
key-value-observing
phonegap
google-qpx-express-api
commit
vsts-build-task
force-layout
file-format
vxworks
hot-module-replacement
streamreader
opshub
lumberjack
email-templates
google-closure
nomethoderror
unixodbc
businessworks
segment
scrollable
azure-application-gateway
winscp-net
veracode
directory-structure
epson
sqldf
titanium-android
dwscript
libpng
probability-density
slicknav
nsfilemanager
django-debug-toolbar
websitepanel
lua-5.1
pagedlist
suffix-tree
pyke
computer-algebra-systems
security-testing
muse
splash
interrupted-exception
unity3d-gui
inmobi
mdt
fpml
id3v2
openexr
marmalade
message-driven-bean
intentservice
ms-project-server-2010
apc
ruby-datamapper
ftps
eclipse-memory-analyzer
buster.js
limejs
work-stealing
libc++
external-accessory
coercion
table-footer
celltable
floating
gamequery
forums
bespin
web-architecture
zend-tool
procedural-music
scripting-languages

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App