-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
멀티스레드로 동작하도록 main 수정 + 총 박수 횟수 몇번인지 세는 class추가
- Loading branch information
Showing
1 changed file
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package JavaPractice.ThreeSixNineGame; | ||
|
||
public class ClapCounter { | ||
// 박수를 친 횟수를 가지고 있는 클래스 만들기 | ||
private int clapTotalCount = 0; | ||
|
||
/** | ||
박수를 친 횟수를 출력하는 메소드 만들기 | ||
결과를 sout 으로 화면에 출력해주세요. | ||
*/ | ||
void printClapCount() { | ||
System.out.println("모든 game의 박수 횟수:" + clapTotalCount); | ||
} | ||
|
||
synchronized void countClap(String clap) { | ||
clapTotalCount += (clap.length() / 4) ; | ||
} | ||
} |