1. ¹è¿À̶õ °°Àº Á¾·ùÀÇ µ¥ÀÌÅÍ n°³°¡ ÇϳªÀÇ À̸§À¸·Î Ç¥½ÃµÇ´Â µ¥ÀÌÅÍÀÇ ¹À½ÀÌ¶ó ¸»ÇÒ ¼ö ÀÖ´Ù. ÀÚ¹Ù¿¡¼´Â ¹è¿ÀÇ »ç¿ë
¹æ¹ýÀÌ ¾Æ·¡¿Í °°Àº ¼ø¼·Î Á¤ÀÇµÇ°í »ç¿ëµÇ¾î Áø´Ù.
¹è¿ÀÇ ¼±¾ð
|
¸Þ¸ð¸® ÇÒ´ç
|
»ç¿ë
|
µ¥ÀÌÅÍÇü º¯¼ö¸í[]; or
µ¥ÀÌÅÍÇü[] º¯¼ö¸í;
|
º¯¼ö=new µ¥ÀÌÅÍÇü[½ÇÁ¦Å©±â]
|
º¯¼ö[÷ÀÚ]
|
Ŭ·¡½º¸í °´Ã¼¸í[] = new Ŭ·¡½º¸í[Å©±â]
|
°´Ã¼¸í[÷ÀÚ]=new »ý¼ºÀÚ¸í
|
|
¿¹) ¹è¿¿¡ À̸§, ÁÖ¼Ò, ¿¬¶ôó¸¦ ÀúÀåÇÏ°í Ãâ·ÂÇÏÀÚ
class test{
public static void main(String arg[]){
String str[];
str = new String[3];
str[0]="¹Ú¿ø±â";
str[1]="¼º³²½Ã ¼öÁ¤±¸";
str[2]="017-351-3491";
for(int i=0 ; i
{
System.out.println(str[i]);
};
};
|
¿¹2] Ŭ·¡½º¸¦ ¹è¿·Î ¼±¾ðÇØ º¸ÀÚ.
public class test
{
public static void main(String args[])
{
testData data[] = new testData[2];
data[0] = new testData();
data[0].irum ="park";
data[0].tel="123";
data[1] = new testData();
data[1].irum="kim";
data[1].tel="456";
System.out.println(data[0].irum);
System.out.println(data[1].irum);
}
};
class testData
{
String irum=new String();
String tel=new String();
};
|
|