๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๋ฐ˜์‘ํ˜•

public์ƒ์„ฑ์ž1

[JAVA] ์ƒ์„ฑ์ž ๋Œ€์‹  ์ •์  ํŒฉํ† ๋ฆฌ ๋ฉ”์†Œ๋“œ๋ฅผ ๊ณ ๋ คํ•ด์•ผ ํ•˜๋Š” ์ด์œ ! ๋จผ์ € ์ •์  ํŒฉํ† ๋ฆฌ ๋ฉ”์†Œ๋“œ๊ฐ€ ๋ญ”์ง€ ์ž˜ ๋ชจ๋ฅด๊ฒ ์œผ๋ฉด ์•„๋ž˜ ํฌ์ŠคํŒ…์„ ๋ณด๊ณ  ์˜ค์ž! [Java] ์ •์  ํŒฉํ† ๋ฆฌ ๋ฉ”์†Œ๋“œ๋ž€? (static factory method) ์ •์  ํŒฉํ† ๋ฆฌ ๋ฉ”์„œ๋“œ ์ •์ (static), ํŒฉํ† ๋ฆฌ(factory), ๋ฉ”์„œ๋“œ(method) GoF๋ผ๋Š” ๋””์ž์ธ ํŒจํ„ด ์ค‘ ํŒฉํ† ๋ฆฌ ํŒจํ„ด์—์„œ ์œ ๋ž˜ํ•œ ๋‹จ์–ด๋กœ ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๋Š” ์—ญํ• ์„ ๋ถ„๋ฆฌํ•˜๊ฒ ๋‹ค๋Š” ๊ฒƒ์„ ๋งํ•œ๋‹ค. (ํ•˜์ง€๋งŒ ์ •์  ํŒฉํ† ๋ฆฌ ๋ฉ” ynzu-dev.tistory.com 1. ์ด๋ฆ„์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ๋‹ค. BigInteger ํด๋ž˜์Šค๋ฅผ ์˜ˆ๋ฅผ ๋“ค์–ด ๋ณด๋ฉด ์ƒ์„ฑ์ž์ธ BigInteger(int, int, Random)๊ณผ ์ •์  ํŒฉํ† ๋ฆฌ ๋ฉ”์„œ๋“œ์ธ probablePrime(int, Random) ์ค‘ ํ›„์ž๊ฐ€ ๋ฉ”์†Œ๋“œ ๋ช…๋•๋ถ„์— '๊ฐ’์ด ์†Œ์ˆ˜์ธ BigInteger๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค'๋ผ๋Š” ์˜๋ฏธ๋ฅผ ํŒŒ์•…ํ•˜๊ธฐ ์‰ฝ๋‹ค.. 2022. 1. 12.
728x90
๋ฐ˜์‘ํ˜•