₦airaland Forum

Welcome, Guest: Register • Login • With Google • Trending • Recent • New

Stats: 3,344,803 members, 8,513,777 topics. Date: Thursday, 05 November 2026 at 01:44 PM

Toggle theme

Unklelouis's Posts

Nairaland Forum › Unklelouis's Profile › Unklelouis's Posts

1 (of 1 pages)

Programming › Problems With Threads And Arrays by unklelouis(op): 1:47am On Apr 08, 2010
Hi, i'm working on this project. I'm trying to create an array of objects. But i can't seem to call the start() method when i get an element from the array. Please look and Help. The line highlighted in red is the one causing problems. thanks

if (cardi == 1) {
                int i = 0;
                Random rand = new Random();
                int position  = rand.nextInt(3);

                Object [] digitArray = new Object[5];

                DodigitsEnglish digitEnglish = new DodigitsEnglish();
                DodigitsFrench digitFrench = new DodigitsFrench();
                DodigitsGerman digitGerman = new DodigitsGerman();

                digitArray[i] = digitEnglish; i++;
                digitArray[i] = digitFrench; i++;
                digitArray[i] = digitGerman; i++;

                Object dodigit = (Runnable)digitArray[position];
               
                new dodigit.Start();

}

1 (of 1 pages)