public class Class2 {
public static void main(String[] args) {
int a = new Integer(3);
int[] b = new int[5];
String c = new String("야옹이");
//GirlFriend girl1 = new GirlFriend();
GirlFriend girl1;//선언
girl1 = new GirlFriend();//초기화
//클래스타입 이름 (내맘대로 )
//=new 클래스 타입(파라미터들)
//myFingerCount 낙타 표기법(camel),myfingercount,MyFingerCount
String f=girl1.face;
System.out.println(f);
}
public static class GirlFriend{
//필드 : 형용사적인 사용으로 상태나 속성을 나타냄
String face = "귀엽다";
String character ="애교 많음";
//메서드: 동작,동사적 사용 : 어떤 기능을 구현
public void goTheater(){
System.out.println("영화 재밌다~^*^");
}
}
}
귀엽다
class Point01{
int x;
int y;
//메서드는 없다.
}
public class Class3 {
public static void main(String[] args) {
Point01 point01= new Point01();//객체 생성
point01.x= 10; //객체의 필드값x에 10저장
point01.y= 20; //객체의 필드값y에 10저장
System.out.printf("x=%d,y=%d",point01.x,point01.y);
}
}
x=10,y=20
'Java > 2012.04 강좌' 카테고리의 다른 글
| 7일차 OverLoading (0) | 2012.04.12 |
|---|---|
| 7일차 Data Hiding (0) | 2012.04.12 |
| 6일차 Class (0) | 2012.04.10 |
| 6일차 메소드2 (0) | 2012.04.10 |
| 6일차 METHOD (0) | 2012.04.10 |