New Posts  All Forums:Forum Nav:

Java quetsion!

post #1 of 5
Thread Starter 
Hi!

I need to return all the object name of one class in an array. I have a class named country, and other classes with athletes and medals etc. I need to do a method that list an array with all the countries that participate, so all the objects created with the class country (i.e canada.country, usa.country, etc). Is there a way I can retreive them?

Thanks!
Black Goblin
(10 items)
 
Legendary Quad
(9 items)
 
 
CPUMotherboardGraphicsRAM
Core i7 3770k  MSI Z77 Mpower eVGA GTX 1070 FTW 32GB | Hyperx Fury 1866Mhz 
Hard DriveCoolingOSMonitor
Samsung 850 Evo 500GB CM Hyper 212 evo Windows 10 Pro Asus MG279Q 
PowerCase
Corsair RM650 Corsair 450D 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q6600 Asus P5K Asus GT 610 Silent 1GB 6GB DDR2 667Mhz 
Hard DriveCoolingOSPower
WD Blue Caviar 500GB Coolermaster Hyper 212+  Windows 8.1 64Bits Antec 500W 
Case
Antec Sonata III 
  hide details  
Reply
Black Goblin
(10 items)
 
Legendary Quad
(9 items)
 
 
CPUMotherboardGraphicsRAM
Core i7 3770k  MSI Z77 Mpower eVGA GTX 1070 FTW 32GB | Hyperx Fury 1866Mhz 
Hard DriveCoolingOSMonitor
Samsung 850 Evo 500GB CM Hyper 212 evo Windows 10 Pro Asus MG279Q 
PowerCase
Corsair RM650 Corsair 450D 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q6600 Asus P5K Asus GT 610 Silent 1GB 6GB DDR2 667Mhz 
Hard DriveCoolingOSPower
WD Blue Caviar 500GB Coolermaster Hyper 212+  Windows 8.1 64Bits Antec 500W 
Case
Antec Sonata III 
  hide details  
Reply
post #2 of 5
Sorry, but to be honest

1. Have you tried anything at all to answer your homework activity?

2. Please dont directly post your homework on the forums and expect other people to do it for you.
post #3 of 5
Thread Starter 
Yes, sorry!

Here it goes

public Country[] getCountry{

int count = (I need to find a way to know how many object of the class Country there is);
Country[] tab = new Country[count];

for(int c = 0 ; c < count ; c++){

tab[c] = first object created with the class Country;
}

return tab;
}

I just wanted to know if there is a way I can get the name of the objects made with the class country, thats it!
Edited by 99Cookies - 3/16/14 at 10:24am
Black Goblin
(10 items)
 
Legendary Quad
(9 items)
 
 
CPUMotherboardGraphicsRAM
Core i7 3770k  MSI Z77 Mpower eVGA GTX 1070 FTW 32GB | Hyperx Fury 1866Mhz 
Hard DriveCoolingOSMonitor
Samsung 850 Evo 500GB CM Hyper 212 evo Windows 10 Pro Asus MG279Q 
PowerCase
Corsair RM650 Corsair 450D 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q6600 Asus P5K Asus GT 610 Silent 1GB 6GB DDR2 667Mhz 
Hard DriveCoolingOSPower
WD Blue Caviar 500GB Coolermaster Hyper 212+  Windows 8.1 64Bits Antec 500W 
Case
Antec Sonata III 
  hide details  
Reply
Black Goblin
(10 items)
 
Legendary Quad
(9 items)
 
 
CPUMotherboardGraphicsRAM
Core i7 3770k  MSI Z77 Mpower eVGA GTX 1070 FTW 32GB | Hyperx Fury 1866Mhz 
Hard DriveCoolingOSMonitor
Samsung 850 Evo 500GB CM Hyper 212 evo Windows 10 Pro Asus MG279Q 
PowerCase
Corsair RM650 Corsair 450D 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q6600 Asus P5K Asus GT 610 Silent 1GB 6GB DDR2 667Mhz 
Hard DriveCoolingOSPower
WD Blue Caviar 500GB Coolermaster Hyper 212+  Windows 8.1 64Bits Antec 500W 
Case
Antec Sonata III 
  hide details  
Reply
post #4 of 5
Thread Starter 
Nervermind I found a way, thanks!
Black Goblin
(10 items)
 
Legendary Quad
(9 items)
 
 
CPUMotherboardGraphicsRAM
Core i7 3770k  MSI Z77 Mpower eVGA GTX 1070 FTW 32GB | Hyperx Fury 1866Mhz 
Hard DriveCoolingOSMonitor
Samsung 850 Evo 500GB CM Hyper 212 evo Windows 10 Pro Asus MG279Q 
PowerCase
Corsair RM650 Corsair 450D 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q6600 Asus P5K Asus GT 610 Silent 1GB 6GB DDR2 667Mhz 
Hard DriveCoolingOSPower
WD Blue Caviar 500GB Coolermaster Hyper 212+  Windows 8.1 64Bits Antec 500W 
Case
Antec Sonata III 
  hide details  
Reply
Black Goblin
(10 items)
 
Legendary Quad
(9 items)
 
 
CPUMotherboardGraphicsRAM
Core i7 3770k  MSI Z77 Mpower eVGA GTX 1070 FTW 32GB | Hyperx Fury 1866Mhz 
Hard DriveCoolingOSMonitor
Samsung 850 Evo 500GB CM Hyper 212 evo Windows 10 Pro Asus MG279Q 
PowerCase
Corsair RM650 Corsair 450D 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q6600 Asus P5K Asus GT 610 Silent 1GB 6GB DDR2 667Mhz 
Hard DriveCoolingOSPower
WD Blue Caviar 500GB Coolermaster Hyper 212+  Windows 8.1 64Bits Antec 500W 
Case
Antec Sonata III 
  hide details  
Reply
post #5 of 5
You could also ask in the school help section? Maybe users may be more receptive there. GL thumb.gif

http://www.overclock.net/f/137/school-help
Bandaids
(15 items)
 
  
MotherboardGraphicsHard DriveOptical Drive
Asrock Z77 Extreme 6 GTX 580 WD 10EALX ASUS DRW 
CoolingOSMonitorMonitor
Havik 140 Windows 7 Ultimate ASUS VH228T Toshiba 32RV600A 
MonitorKeyboardPowerCase
Compaq S2021a Microsoft Wired Keyboard 600 Aero Cool Strike X 1100w Asus Antec 
MouseMouse PadAudio
Logitech MX518 Mionix Ensis 320 Creative 2.1 
  hide details  
Reply
Bandaids
(15 items)
 
  
MotherboardGraphicsHard DriveOptical Drive
Asrock Z77 Extreme 6 GTX 580 WD 10EALX ASUS DRW 
CoolingOSMonitorMonitor
Havik 140 Windows 7 Ultimate ASUS VH228T Toshiba 32RV600A 
MonitorKeyboardPowerCase
Compaq S2021a Microsoft Wired Keyboard 600 Aero Cool Strike X 1100w Asus Antec 
MouseMouse PadAudio
Logitech MX518 Mionix Ensis 320 Creative 2.1 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming