티스토리 뷰
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
- 코드
- 경제신문
- 프로그래머스
- 프로그래밍
- python
- SW
- 금리
- 코딩테스트
- 함수
- 머신러닝
- 자바
- 보안
- 데이터
- 데이터분석
- 스마트워치
- 경제
- 코딩
- mysql
- plot
- R
- 그래프
- sql
- 영어
- 코테
- 개발
- 클래스
- 모듈
- Programming
- 영어회화
- 파이썬
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 | 31 |
글 보관함