티스토리 뷰
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
- 데이터분석
- 함수
- 코드
- 스마트워치
- 영어
- 코딩테스트
- mysql
- 경제
- plot
- 보안
- 코딩
- 경제신문
- SW
- 클래스
- 코테
- 데이터
- 그래프
- 개발
- python
- 프로그래밍
- 파이썬
- 머신러닝
- 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 |
글 보관함