public static void run() { StudentThreaded student = StudentThreaded.getInstance(); Console.WriteLine("Name: " + student.getName() + ", Standing: " + Math.Round(student.getStanding())); }
public static void TestFlyweightThreaded() { String[] names = { "Ralph", "Alice", "Sam" }; int[] ids = { 1001, 1002, 1003 }; int[] scores = { 45, 55, 65 }; double total = 0; for (int loopIndex = 0; loopIndex < scores.Length; loopIndex++) { total += scores[loopIndex]; } double averageScore = total / scores.Length; StudentThreaded student = StudentThreaded.getInstance(); student.setAverageScore(averageScore); student.setName("Ralph"); student.setId(1002); student.setScore(45); var thread = new Thread(run); thread.Start(); Console.WriteLine("Name: " + student.getName() + ", Standing: " + Math.Round(student.getStanding())); }