반응형
반응형
본문 바로가기

java8

For this problem you must define a simple interface NumTrackerInterface and two implementations of the interface, For this problem you must define a simple interface NumTrackerInterface and two implementations of the interface, Tracker1 and Tracker2. a. Define a Java interface named NumTrackerInterface. A class that implements this interface must keep track of both the sum and the count of numbers that are submitted to it through its add method, and provide getters for the sum, the count, and the average of.. 2022. 3. 12.
[OODP] Singleton Pattern (싱글톤 패턴)이란 [OODP] Singleton Pattern (싱글톤 패턴)이란 프로그램을 작동시키면 보통 많은 인스턴스가 생성됩니다. 예를 들면, 문자열을 나타내는 java.lang.String 클래스의 인스턴스는 문자열 1개에 대해서 1개가 생성되기 때문에 문자열이 1,000개 등장하는 프로그램이라면 1,000개의 인스턴스가 만들어집니다. 그러나 시스템 속에 1개 밖에 존재하지 않는 것을 프로그램으로 표현하고자 하는 경우에는 클래스의 인스턴스를 하나만 만듭니다. 컴퓨터 자체를 표현한 클래스, 현재의 시스템 설정을 표현한 클래스, 윈도우 시스템을 표현한 클래스 등이 예시입니다. 프로그래밍할 때 개발자가 new Class()가 한번밖에 실행되지 않도록 작성해 놓으면 Class()의 인스턴스는 1개만 생성됩니다. 이렇게 .. 2021. 4. 4.
Java Socket 메시지 주고받기 Java Socket 메시지 주고받기 예시 01 / Example 01) 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 package server; import java.io.IOException; import java.io.OutputStream; import java.net.ServerSocket; import java.net.Socket; public class MainServer { public static void main(String[] args) { try { ServerSocket s_socket = new ServerSocket(8888); Socket c_socket = s_socket.accpet(); .. 2021. 4. 3.
Java Socket Test Example (1) 자바 소켓 예시 Java Socket Test Example (1) 자바 소켓 예시 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 32 33 34 35 36 37 38 39 40 41 42 43 package SocketTest; import java.io.*; import java.net.*; public class EchoClient { public static void main(String[] args) { try { String host; if (args.length > 0) { host=args[0]; } else { host = "localhost"; // host = "172.17.193.68"; } So.. 2021. 4. 3.
[OODP] Singleton Pattern (싱글톤 패턴) [OODP] Singleton Pattern (싱글톤 패턴) 1. webdevtechblog.com/%EC%8B%B1%EA%B8%80%ED%84%B4-%ED%8C%A8%ED%84%B4-singleton-pattern-db75ed29c36 싱글턴 패턴(Singleton Pattern) 자바와 스프링의 싱글턴 패턴(Singleton Pattern)과 차이점 webdevtechblog.com 2. velog.io/@kyle/%EC%9E%90%EB%B0%94-%EC%8B%B1%EA%B8%80%ED%86%A4-%ED%8C%A8%ED%84%B4-Singleton-Pattern 자바 싱글톤 패턴 (Singleton Pattern) 안녕하세요. 이번 포스팅에서는 자바의 싱글톤 패턴에 대해서 이야기하고자 합니다. 무한으.. 2021. 4. 1.
[어댑터 패턴] Class Adaptor vs. Object Adaptor [어댑터 패턴] Class Adaptor vs. Object Adaptor Class Adapter uses inheritance and can only wrap a class. It cannot wrap an interface since by definition it must derive from some base class. Object Adapter uses composition and can wrap classes or interfaces, or both. It can do this since it contains, as a private, encapsulated member, the class or interface object instance it wraps. - 클래스 어댑터는 상속(Inhe.. 2021. 3. 27.
Chain of Responsibility Design Pattern (책임연쇄패턴) Chain of Responsibility Design Pattern (책임연쇄패턴) k0102575.github.io/articles/2020-02/chain-of-responsibility-pattern 책임 연쇄 패턴(chain-of-responsibility pattern) 연쇄책임패턴 (Chain-of-responsibility pattern) k0102575.github.io - 대개 핸들러 한 개와 여러 개의 하위 연산 클래스들이 존재한다. - 짧게 CoR pattern 이라고 함. - 어떤 요청이 그 요청을 담당하는 객체에 들어오면 각각의 요청에 대해서 특정한 객체가 담당하는 것이 일반적이지만 객체를 연결리스트와 같은 사슬 방식으로 연결한 후에 요청을 수행하지 못하는 객체라면 다음 객체에 .. 2021. 3. 11.
Eclipse에서 UML diagram 그리기 Eclipse에서 UML diagram 그리기 1. Online UML diagram design tool online.visual-paradigm.com/ 2. Eclipse에서 Class Diagram 만들기 all-record.tistory.com/128 이클립스에서 클래스다이어그램 만들기(ObjectAid) 이클립스에서 클래스 다이어그램을 생성할 수 있는 ObjectAid라는 플러그인이 있다. 설치하고 나면 프로젝트의 java 파일들을 드래그&드롭 하는 것으로 간단하게 클래스들의 관계도가 만들어지므 all-record.tistory.com 3. UML Basic Notations www.tutorialspoint.com/uml/uml_basic_notations.htm UML - Basic Not.. 2021. 3. 11.

반응형