Retro Of Alexkid

여러 이야기
 by 알렉스키드
2021. 4. 22. 23:05 안드로이드, IOS
안드로이드 앱 공부 (2)

오늘은 자바 공부를 하였다.

// 클래스 이름 
public class Person {

//멤버변수(필드)
//상태, 속성
int x, y;
int power;
String color;
String name;


//멤버메소드
//동작, 기능 수행
void moveForward() {
x+=5;
}
void moveBack() {
y-=5;
}

// 생성자
//멤버변수초기화(this는 객체 자신 의미)
//객체멤버와 구별 시키기 위해서
Person(int x, int y, String color, String name) {
this.x=x;
this.y=y;
this.color=color;
this.name=name;
}

}

//객체생성
1.
클래스명 객체명 = new 클래스명();
Person r1 = new Person(); // (사람이 생성 됨)

2. (이건 뭐지?)
Person Person1; // 객체 선언 객체 이름
r1 = new Person(); //객체 생성
 
3. 
r1.color = "Red"; //객체명.멤버변수
r.1.name = "Person1";

2-2.
Person r2 = new Person();
r2.color = "노란색";
r2.name = "Person2";

 

 

안드로이드 앱 화면 구성 공부 조금 함..

 

<Button
	andoid:layout_width="wrap_content"
	andoid:layout_height="wrap_content"
	andoid:text="BUTTON~!" />

wrap_content : 뷰 크기에 맞추어 크기를 지정.

 

 

아무 사진이나 잡은게 저 잡지 표지로 앱 아이콘 바꿔볼까 생각중...

'안드로이드, IOS' 카테고리의 다른 글

안드로이드 앱 공부(3)  (0) 2021.04.23
안드로이드 앱 공부 (1)  (0) 2021.04.21



Total / Today / Yesterday
Image by ポカポカ色
Tag by Passion
Designed by Ritz