• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps create a static array of objects in java?

aidanmack

Lurker
Jan 1, 2014
3
0
Hi,
Im a little new too java programming. Im looking for a means to store groups of static data..
so I understand these simple string arrays...

[HIGH]
private static String[] names = new String[] {
"aidanmack",
"johnsmith"
}
private static String[] ages = new String[] {
"30",
"30"
}
[/HIGH]


But can I not combine that into an array of objects? somthing along the lines of what you would do with json? like...

[HIGH]
private static array[] multi = new array(){
{"name":"AIDANMACK","age":"30"},
{"name":"johnsmith","age":"31"}

}
[/HIGH]

Thanks
Aidan
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones