티스토리 뷰
1. Card 클래스의 static 변수 width를 출력하세요.
2. Card 인스턴스의 멤버 변수 number를 출력하세요.
class Card {
static int width = 10;
int number = 8;
int drawCardNumber() {
int pnumber;
pnumber = getRandomInt(1, 13);
return pnumber;
}
private static int getRandemInt(int min, int max) {
int randInt = (int)(Math.random() * max) + min;
return randInt;
}
}
public class Main {
public static void main(String args[]) {
Card c = new Card();
System.out.println(Card.width);
System.out.println(c.number);
}
}
'JAVA' 카테고리의 다른 글
캡슐화 활용해보기(2) (0) | 2023.09.19 |
---|---|
캡슐화 활용해보기(1) (0) | 2023.09.19 |
static 메소드 (0) | 2023.09.19 |
static 변수 (0) | 2023.09.19 |
생성자 오버로드 (0) | 2023.09.19 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Programming
- 모듈
- 영어
- 코딩
- 그래프
- 프로그래밍
- 파이썬
- plot
- python
- 데이터
- sql
- 개발
- 머신러닝
- mysql
- 데이터분석
- 보안
- SW
- 금리
- 코드
- 자바
- 영어회화
- R
- 경제
- 스마트워치
- 프로그래머스
- 코딩테스트
- 함수
- 클래스
- 경제신문
- 코테
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
글 보관함