U E D R , A S I H C RSS

2학기자바스터디/운세게임

고리 는게 라 랜덤
랜덤

Date Calendar 는 방법

Date


~cpp 
 Date today = new Date(); // today라는  Date객 
 System.out.println(today); // 바로 today가 String동변 늘 날 

려면 SimpleDateFormat 를 같 다.


~cpp 
 SimpleDateFormat dateForm = new SimpleDateFormat("yyyy MM dd hh mm ss"); //  
 System.out.println(dateForm.format(today)); // today란 Date객를 dateForm  맞게 


y
M
d
h (1~12)
H (0~23)
m
s
S 1/1000
E
a /

Calendar

~cpp 
 Calendar now = Calendar.getInstance(); // 로부 
 int hour = now.get(Calendar.HOUR); //  기
 int min  = now.get(Calendar.MINUTE); //  

Calendar
YEAR
MONTH
DATE
HOUR (1~12)
HOUROFDAY (0~23)
MINUTE
SECOND
MILLISECOND 1/1000
DAYOFWEEK
AMPM /

(Random)

~cpp 
 Random r = new Random();
 int num = r.nextInt(); // Int범(-2147483648 ~ 214783647) 
 int num2 = r.nextInt() % 10; // -9 ~ 9 기
 int num3 = Math.abs(r.nextInt() % 10); // 0 ~ 9 기. Math.abs()는 대값

과 같
~cpp 
2003 9 27  
:-97%
감:43%
:-99%
각:-96%

늘날력되고
,감,, -100 ~ 100 랜덤값(다 바뀜)

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:22:13
Processing time 0.0130 sec