using System;
namespace Study07
{
class Program
{
static void Main(string[] args)
{
new App();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Study07
{
class App
{
//생성자
public App()
{
Console.WriteLine("App생성자");
Students student0 = new Students();
student0.studentID = 100;
student0.studentName = "홍길동";
student0.studentScore = 89;
Students student1 = new Students();
student1.studentID = 101;
student1.studentName = "임꺽정";
student1.studentScore = 92;
Students student2 = new Students();
student2.studentID = 102;
student2.studentName = "장길산";
student2.studentScore = 78;
Students[] students = { student0, student1, student2, null, null };
foreach(Students student in students)
{
if(student!=null)
Console.WriteLine("{0},{1},{2}",student.studentID, student.studentName, student.studentScore);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Study07
{
class Students
{
public int studentID;
public string studentName;
public int studentScore;
public Students()
{
Console.WriteLine("students 배열 요소 생성");
}
}
}