public void toString(Student st) { Console.WriteLine("\n\n***************************** Output of ToString Method *****************************\n"); Console.WriteLine("\nName " + st.numberOfWordsInName()); Console.WriteLine("Registration Number: " + st.registerationNumber); Console.WriteLine("CGPA: " + st.getStatus()); Console.WriteLine("Date of Birth: " + st.getAge()); Console.WriteLine("CNIC: " + st.CNIC); Console.WriteLine("Gender: " + st.getGender()); Console.Write("Hobbies: "); if (st.hobbies != null) { for (int i = 0; i < st.hobbies.Length; i++) { if (i < st.hobbies.Length - 1) { Console.Write(st.hobbies[i] + ", "); } else { Console.Write(st.hobbies[i]); } } } }