<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>디케이</title>
    <link>https://d8040.tistory.com/</link>
    <description></description>
    <language>ko</language>
    <pubDate>Mon, 29 Jun 2026 08:40:32 +0900</pubDate>
    <generator>TISTORY</generator>
    <ttl>100</ttl>
    <managingEditor>디케이형</managingEditor>
    <item>
      <title>[JavaScript] Ajax 기본 설명 동작</title>
      <link>https://d8040.tistory.com/206</link>
      <description>&lt;div class=&quot;sc-bbmXgH gDQvzU atom-one-light&quot;&gt;&lt;h1 id=&quot;ajax-asynchronous-javascript-and-xml&quot;&gt;AJAX (Asynchronous Javascript And XML)&lt;/h1&gt;
&lt;p&gt;AJAX란, JavaScript의 라이브러리중 하나이며 Asynchronous Javascript And Xml(비동기식 자바스크립트와 xml)의 약자이다. 브라우저가 가지고있는 XMLHttpRequest 객체를 이용해서 전체 페이지를 새로 고치지 않고도 페이지의 일부만을 위한 데이터를 로드하는 기법 이며 &lt;strong&gt;JavaScript를 사용한 비동기 통신, 클라이언트와 서버간에 XML 데이터를 주고받는 기술&lt;/strong&gt;이다.&lt;/p&gt;
&lt;p&gt;즉, 쉽게 말하자면 &lt;strong&gt;자바스크립트를 통해서 서버에 데이터를 요청하는 것&lt;/strong&gt;이다.&lt;/p&gt;
&lt;h2 id=&quot;비동기-방식이란&quot;&gt;비동기 방식이란?&lt;/h2&gt;
&lt;p&gt;비동기 방식은 웹페이지를 리로드하지 않고 데이터를 불러오는 방식이며 Ajax를 통해서 서버에 요청을 한 후 멈추어 있는 것이 아니라 그 프로그램은 계속 돌아간다는 의미를 내포하고 있다.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://media.vlpt.us/post-images/surim014/233bbf90-2d60-11ea-a24d-4f910e80580b/image.png&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;비동기-방식의-장점&quot;&gt;비동기 방식의 장점&lt;/h3&gt;
&lt;p&gt;페이지 리로드의 경우 전체 리소스를 다시 불러와야하는데 이미지, 스크립트 , 기타 코드등을 모두 재요청할 경우 불필요한 리소스 낭비가 발생하게 되지만 비동기식 방식을 이용할 경우 &lt;strong&gt;필요한 부분만 불러와 사용할 수 있으므로 매우 큰 장점이 있다.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id=&quot;ajax를-사용-가능하게-만드는-것들&quot;&gt;AJAX를 사용 가능하게 만드는 것들&lt;/h2&gt;
&lt;p&gt;AJAX라는 기술은 여러가지 기술이 혼합적으로 사용되어 이루어진다. 대표적인 예로는 아래와 같은 것들이 있다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;HTML&lt;/li&gt;
&lt;li&gt;DOM&lt;/li&gt;
&lt;li&gt;JavaScript&lt;/li&gt;
&lt;li&gt;XMLHttpRequest&lt;/li&gt;
&lt;li&gt;Etc&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;ajax로-할-수-있는-것&quot;&gt;AJAX로 할 수 있는 것&lt;/h2&gt;
&lt;p&gt;AJAX라는 네트워크 기술을 이용하여 &lt;strong&gt;클라이언트에서 서버로 데이터를 요청&lt;/strong&gt;하고 그에 대한 &lt;strong&gt;결과를 돌려받을 수 있다.&lt;/strong&gt;&lt;/p&gt;
&lt;h3 id=&quot;클라이언트란&quot;&gt;클라이언트란?&lt;/h3&gt;
&lt;p&gt;서버에서 정보를 가져와서 사용자에게 보여줄 수 있고 &lt;strong&gt;사용자와 상호작용할 수 있는 소프트웨어&lt;/strong&gt;를 일컫는다.&lt;br&gt;
Ex) 웹브라우저, 핸드폰 어플리케이션 등...&lt;/p&gt;
&lt;h3 id=&quot;서버란&quot;&gt;서버란?&lt;/h3&gt;
&lt;p&gt;네트워크 상에서 접근할 수 있는 프로그램으로서 &lt;strong&gt;어떤 자료들에 대한 관리나 접근을 제어해주는 프로그램&lt;/strong&gt;을 말한다. 서버는 일반적으로 사용자가 직접적으로 사용하지 않는다.&lt;/p&gt;
&lt;h2 id=&quot;ajax를-사용하는-이유&quot;&gt;AJAX를 사용하는 이유&lt;/h2&gt;
&lt;p&gt;단순하게 WEB화면에서 무언가 부르거나 데이터를 조회하고 싶을 경우, 페이지 전체를 새로고침하지 않기 위해 사용한다고 볼 수 있다.&lt;/p&gt;
&lt;p&gt;기본적으로 HTTP 프로토콜은 클라이언트쪽에서 Request를 보내고 서버쪽에서 Response를 받으면 이어졌던 연결이 끊기게 되어있다. 그래서 화면의 내용을 갱신하기 위해서는 다시 request를 하고 response를 하며 페이지 전체를 갱신하게 된다. 하지만 이렇게 할 경우, 엄청난 자원낭비와 시간낭비를 초래하고 말 것이다.&lt;/p&gt;
&lt;p&gt;AJAX는 HTML 페이지 전체가 아닌 일부분만 갱신할 수 있도록 XMLHttpRequest객체를 통해 서버에 request한다. 이 경우, &lt;strong&gt;JSON이나 XML형태로 필요한 데이터만 받아 갱신하기 때문에 그만큼의 자원과 시간을 아낄 수 있다.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id=&quot;ajax의-장단점&quot;&gt;AJAX의 장단점&lt;/h2&gt;
&lt;h3 id=&quot;1-ajax의-장점&quot;&gt;1. AJAX의 장점&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;웹페이지의 속도향상&lt;/li&gt;
&lt;li&gt;서버의 처리가 완료될 때까지 기다리지 않고 처리가 가능하다.&lt;/li&gt;
&lt;li&gt;서버에서 Data만 전송하면 되므로 전체적인 코딩의 양이 줄어든다.&lt;/li&gt;
&lt;li&gt;기존 웹에서는 불가능했던 다양한 UI를 가능하게 해준다. ( Flickr의 경우, 사진의 제목이나 태그를 페이지의 리로드 없이 수정할 수 있다.)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;2-ajax의-단점&quot;&gt;2. AJAX의 단점&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;히스토리 관리가 되지 않는다.&lt;/li&gt;
&lt;li&gt;페이지 이동없는 통신으로 인한 보안상의 문제가 있다.&lt;/li&gt;
&lt;li&gt;연속으로 데이터를 요청하면 서버 부하가 증가할 수 있다.&lt;/li&gt;
&lt;li&gt;XMLHttpRequest를 통해 통신하는 경우, 사용자에게 아무런 진행 정보가 주어지지 않는다. (요청이 완료되지 않았는데 사용자가 페이지를 떠나거나 오작동할 우려가 발생하게 된다.)&lt;/li&gt;
&lt;li&gt;AJAX를 쓸 수 없는 브라우저에 대한 문제 이슈가 있다.&lt;/li&gt;
&lt;li&gt;HTTP 클라이언트의 기능이 한정되어 있다.&lt;/li&gt;
&lt;li&gt;지원하는 Charset이 한정되어 있다.&lt;/li&gt;
&lt;li&gt;Script로 작성되므로 디버깅이 용이하지 않다.&lt;/li&gt;
&lt;li&gt;동일-출처 정책으로 인하여 다른 도메인과는 통신이 불가능하다. (Cross-Domain문제)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;ajax의-진행과정&quot;&gt;AJAX의 진행과정&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;XMLHttpRequest Object를 만든다.&lt;ul&gt;
&lt;li&gt;request를 보낼 준비를 브라우저에게 시키는 과정&lt;/li&gt;
&lt;li&gt;이것을 위해서 필요한 method를 갖춘 object가 필요함&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;callback 함수를 만든다.&lt;ul&gt;
&lt;li&gt;서버에서 response가 왔을 때 실행시키는 함수&lt;/li&gt;
&lt;li&gt;HTML 페이지를 업데이트 함&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Open a request&lt;ul&gt;
&lt;li&gt;서버에서 response가 왔을 때 실행시키는 함수&lt;/li&gt;
&lt;li&gt;HTML 페이지를 업데이트 함&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;send the request&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;ajax가-쓰이는-방법&quot;&gt;AJAX가 쓰이는 방법&lt;/h2&gt;
&lt;p&gt;XMLHttpRequest 객체를 얻은 뒤, url을 통해 요청하고 응답을 받으면 응답 결과에 맞는 함수를 실행하는 구조로 되어 있다. Ajax가 효율적이라고는 해도 이렇게 하게 될 경우, 코드가 길어지기 때문에 jQuery에서 그 문제를 해결해주고 있다.&lt;/p&gt;
&lt;h3 id=&quot;예시로-보는-ajax---1&quot;&gt;예시로 보는 AJAX - 1&lt;/h3&gt;
&lt;pre class=&quot; language-null&quot;&gt;&lt;code class=&quot; language-null&quot;&gt;// This function gets invoked when server sends the response
function reqListener (e) {
    console.log(e.currentTarget.response);
}

var oReq = new XMLHttpRequest();
var serverAddress = &quot;https://hacker-news.firebaseio.com/v0/topstories.json&quot;;

oReq.addEventListener(&quot;load&quot;, reqListener);
oReq.open(&quot;GET&quot;, serverAddress);
oReq.send();&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;위의 예제는 &lt;strong&gt;자바스크립트를 이용하여 특정 서버에 요청을 보내고 그에 대한 자료를 성공적으로 받아올 수 있음을 확인&lt;/strong&gt;해볼 수 있다. 위 예제에서는 XMLHttpRequest를 이용하여 요청을 보냈지만 일반적으로는 아래와 같이 jQuery나 기타 AJAX 기능이 내장되어 있는 라이브러리를 이용하여 AJAX 요청을 처리한다.&lt;/p&gt;
&lt;pre class=&quot; language-null&quot;&gt;&lt;code class=&quot; language-null&quot;&gt;var serverAddress = 'https://hacker-news.firebaseio.com/v0/topstories.json';

// jQuery의 .get 메소드 사용
$.ajax({
    url: ,
    type: 'GET',
    success: function onData (data) {
        console.log(data);
    },
    error: function onError (error) {
        console.error(error);
    }
});&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;예시로-보는-ajax---2&quot;&gt;예시로 보는 AJAX - 2&lt;/h3&gt;
&lt;pre class=&quot; language-null&quot;&gt;&lt;code class=&quot; language-null&quot;&gt;var xhr= new XMLHttpRequest();

xhr. onreadystatechange = function(){
	if(xhr.readyState===4){
    	document.getElementById(‘ajax’).innerHTML= xhr.responseText;
    }
}

xhr.open(‘GET’,”sidebar.html”);  // html메소드와 URL을 보낸다. (open함수는 준비를 시키는것이지 보내는 것은 아니다.)
xhr.send(); &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;위의 예제는 AJAX가 XHR객체를 형성하고 이 객체의 콜백을 만들고 HTML메소드와 URL을 결정한 뒤, XHR객체의 메소드로 정보를 보내는 방식이다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;var xhr= new XMLHttpRequest();&lt;/strong&gt; : browser response를 얻었을 때 작동하는 함수 (callback 함수)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;xhr.onreadystatecjange&lt;/strong&gt; : AJAX Request에 어떠한 변화라도 있으면 작동한다. (callback 함수를 포함하고 있다고 생각하면 된다.)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;xhr.readyState&lt;/strong&gt; : response가 돌아왔는지 아닌지를 추적하는 property&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;참고사이트&quot;&gt;참고사이트&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=i6YR6af8Qug&quot;&gt;How to debug Ajax requests with Google Chrome Inspector&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/ko/docs/Web/HTTP&quot;&gt;HTTP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous/Concepts&quot;&gt;Asynchronous Javascript&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://wikidocs.net/22372&quot;&gt;컴퓨터 통신 방식 중 동기/비동기란&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/HackerNews/API&quot;&gt;HackerNews API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://coding-factory.tistory.com/143&quot;&gt;coding-factory - AJAX&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://wherethelightis.tistory.com/14&quot;&gt;wtl - AJAX&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vanillacoding.co/&quot;&gt;vanillacoding&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://m.blog.naver.com/magnking/220942289678&quot;&gt;magnking - AJAX&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://wherethelightis.tistory.com/14&quot;&gt;wherethelightis - AJAX&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://devyj.tistory.com/1&quot;&gt;devyj - AJAX&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://devyj.tistory.com/2&quot;&gt;devyj - GET vs POST&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://gxnzi.tistory.com/67&quot;&gt;gxnzi - AJAX&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://jayzzz.tistory.com/67&quot;&gt;jayzzz - AJAX&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://dororongju.tistory.com/95&quot;&gt;dororongju - AJAX&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://gangnam-americano.tistory.com/29&quot;&gt;gangnam-americano - AJAX&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</description>
      <category>HTML, CSS</category>
      <author>디케이형</author>
      <guid isPermaLink="true">https://d8040.tistory.com/206</guid>
      <comments>https://d8040.tistory.com/206#entry206comment</comments>
      <pubDate>Wed, 10 Mar 2021 10:42:16 +0900</pubDate>
    </item>
    <item>
      <title>이클립스 JSP, html 이용시 초기 셋팅</title>
      <link>https://d8040.tistory.com/205</link>
      <description>&lt;h2&gt;이클립스 JSP, html 이용시 초기 셋팅&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;window &amp;gt;&amp;gt; preference 실행&lt;/li&gt;
&lt;li&gt;html 검색&lt;/li&gt;
&lt;li&gt;HTML Files &amp;gt;&amp;gt; Editor 선택&lt;/li&gt;
&lt;li&gt;Inline Elements 에서 아래 항목 삭제
&lt;ul&gt;
&lt;li&gt;a, b,&amp;nbsp;br, i, img, input,&amp;nbsp;label,&amp;nbsp;li,&amp;nbsp;s,&amp;nbsp;select,&amp;nbsp;span,&amp;nbsp;strong,&amp;nbsp;td,&amp;nbsp;th,&amp;nbsp;title&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;</description>
      <category>HTML, CSS</category>
      <author>디케이형</author>
      <guid isPermaLink="true">https://d8040.tistory.com/205</guid>
      <comments>https://d8040.tistory.com/205#entry205comment</comments>
      <pubDate>Sun, 28 Feb 2021 15:15:01 +0900</pubDate>
    </item>
    <item>
      <title>[html] onclick시 location.href와 location.replace 차이</title>
      <link>https://d8040.tistory.com/204</link>
      <description>&lt;p&gt;K.html, a.html, b.html&lt;br /&gt;3개에 페이지가 있다고 가정할때&lt;br /&gt;페이지 이동 방법은 크게 &lt;b&gt;3가지&lt;/b&gt;가 있습니다.&lt;/p&gt;
&lt;pre class=&quot;hsp&quot;&gt;&lt;code&gt;//1번째 방법
&amp;lt;button onclick=&quot;location.href&quot; = 'b.html';&quot;&amp;gt;B로 이동&amp;lt;/button&amp;gt;
//2번째 방법
&amp;lt;button onclick=&quot;location.replace('b.html');&quot;&amp;gt;B로 이동&amp;lt;/button&amp;gt;
//3번째 방법
&amp;lt;a href=&quot;b.html&quot;&amp;gt;B로 이동&amp;lt;/a&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;위 3가지 방법에 차이는 backspace(뒤로가기)를 눌렀을때 발생합니다.&lt;br /&gt;k &amp;gt;&amp;gt; a &amp;gt;&amp;gt; b로 이동하는 코드를 구성했다고 했을때&lt;br /&gt;1, 3번 방법은 뒤로가기를 눌렀을때 a로 가는 반면&lt;br /&gt;2번 방법은 k 로 돌아 갑니다.&lt;/p&gt;
&lt;p&gt;이를 활용해 결재 나 글쓰기 같은 쿼리를 전달해야 할때는 2번 replace를 쓰며&lt;br /&gt;쿼리가 &lt;b&gt;중복 발송이 되는 에러를 미연에 방지&lt;/b&gt; 할 수 있는 이점이 있습니다.&lt;/p&gt;</description>
      <category>HTML, CSS</category>
      <author>디케이형</author>
      <guid isPermaLink="true">https://d8040.tistory.com/204</guid>
      <comments>https://d8040.tistory.com/204#entry204comment</comments>
      <pubDate>Sun, 28 Feb 2021 14:30:33 +0900</pubDate>
    </item>
    <item>
      <title>[html] form 작성 시 get과 post 차이점</title>
      <link>https://d8040.tistory.com/203</link>
      <description>&lt;h1&gt;GET&lt;/h1&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&amp;quot;http://locallhost:8021/usr/home/main&amp;quot; method=&amp;quot;GET&amp;quot;&amp;gt;
  &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;age&amp;quot; value=&amp;quot;11&amp;quot;&amp;gt;
  &amp;lt;input type=&amp;quot;submit&amp;quot; value=&amp;quot;전송&amp;quot;&amp;gt;
&amp;lt;/form&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;위와 같은 폼에서 전송으로 get처리 하면 아래와 같은 url생성&lt;br&gt;&lt;a href=&quot;http://localhost:8021/usr/home/main?age=11&quot;&gt;http://localhost:8021/usr/home/main?age=11&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;기본적인 HTTP Request(요청서)&lt;br&gt;--- Header ---&lt;br&gt;주소: &lt;a href=&quot;http://localhost:8021/usr/home/main&quot;&gt;http://localhost:8021/usr/home/main&lt;/a&gt;&lt;br&gt;쿼리 파라미터: age=11&lt;br&gt;--- Body ---&lt;/p&gt;
&lt;h1&gt;POST&lt;/h1&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;form action=&amp;quot;http://locallhost:8021/usr/home/main&amp;quot; method=&amp;quot;POST&amp;quot;&amp;gt;
  &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;age&amp;quot; value=&amp;quot;11&amp;quot;&amp;gt;
  &amp;lt;input type=&amp;quot;submit&amp;quot; value=&amp;quot;전송&amp;quot;&amp;gt;
&amp;lt;/form&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;위와 같은 폼에서 전송으로 post처리 하면 아래와 같은 url생성&lt;br&gt;&lt;a href=&quot;http://localhost:8021/usr/home/main?age=11&quot;&gt;http://localhost:8021/usr/home/main?age=11&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;기본적인 HTTP Request(요청서)&lt;br&gt;--- Header ---&lt;br&gt;주소: &lt;a href=&quot;http://localhost:8021/usr/home/main&quot;&gt;http://localhost:8021/usr/home/main&lt;/a&gt;&lt;br&gt;쿼리 파라미터:&lt;br&gt;--- Body ---&lt;br&gt;age=11&lt;/p&gt;
&lt;h2&gt;정리&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;get은 부가정보 쿼리파라미터가 Header에 생성 post는 Body에 생성&lt;/li&gt;
&lt;/ul&gt;</description>
      <category>HTML, CSS</category>
      <author>디케이형</author>
      <guid isPermaLink="true">https://d8040.tistory.com/203</guid>
      <comments>https://d8040.tistory.com/203#entry203comment</comments>
      <pubDate>Sun, 28 Feb 2021 11:22:01 +0900</pubDate>
    </item>
    <item>
      <title>[java] 인터셉터 구조</title>
      <link>https://d8040.tistory.com/202</link>
      <description>&lt;p&gt;현재 스프링부트를 사용해 서비스를 구현 중 &lt;span style=&quot;color: #333333;&quot;&gt;개발 기록을 정리 하기위해 &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #333333;&quot;&gt;인터셉터에 대해 정리 해보려고 합니다.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;1.&amp;nbsp;beforeActionInterceptor &lt;br /&gt;&amp;nbsp;&amp;nbsp;-&amp;nbsp;정보강화 &lt;br /&gt;&amp;nbsp;&amp;nbsp;-&amp;nbsp;없는&amp;nbsp;정보를&amp;nbsp;만들지는&amp;nbsp;않지만&amp;nbsp;세션&amp;nbsp;정보를&amp;nbsp;꺼내서&amp;nbsp;기존에&amp;nbsp;있는&amp;nbsp;정보를&amp;nbsp;정리&amp;nbsp;해둔다 &lt;br /&gt;&amp;nbsp;&amp;nbsp;-&amp;nbsp;가장&amp;nbsp;먼저&amp;nbsp;동작&lt;/p&gt;
&lt;pre id=&quot;code_1614430888996&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;@Component(&quot;beforeActionInterceptor&quot;) // 컴포넌트 이름 설정
public class BeforeActionInterceptor implements HandlerInterceptor {
    @Autowired
    private MemberService memberService;

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

	HttpSession session = request.getSession();

	// 로그인 여부에 관련된 정보를 request에 담는다.
	boolean isLogined = false;
	boolean isAdmin = false;
	int loginedMemberId = 0;
	Member loginedMember = null;

	if (session.getAttribute(&quot;loginedMemberId&quot;) != null) {
	    loginedMemberId = (int) session.getAttribute(&quot;loginedMemberId&quot;);
	    isLogined = true;
	    loginedMember = memberService.getMember(loginedMemberId);
	    isAdmin = memberService.isAdmin(loginedMemberId);
	}

	request.setAttribute(&quot;loginedMemberId&quot;, loginedMemberId);
	request.setAttribute(&quot;isLogined&quot;, isLogined);
	request.setAttribute(&quot;isAdmin&quot;, isAdmin);
	request.setAttribute(&quot;loginedMember&quot;, loginedMember);

	return HandlerInterceptor.super.preHandle(request, response, handler);
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;2.&amp;nbsp;needAdminInterceptor &lt;br /&gt;&amp;nbsp;&amp;nbsp;-&amp;nbsp;관리자&amp;nbsp;관련&amp;nbsp;항목으로&amp;nbsp;일반사용자&amp;nbsp;접속을&amp;nbsp;걸러준다 &lt;br /&gt;&amp;nbsp;&amp;nbsp;-&amp;nbsp;ajax&amp;nbsp;문법을&amp;nbsp;사용했다면&amp;nbsp;json으로&amp;nbsp;응답 &lt;br /&gt;&amp;nbsp;&amp;nbsp;-&amp;nbsp;ajax가&amp;nbsp;아니라면&amp;nbsp;javascript로&amp;nbsp;응답 &lt;br /&gt;&amp;nbsp;&amp;nbsp;-&amp;nbsp;로그인까지는&amp;nbsp;예외&amp;nbsp;적용 &lt;/p&gt;
&lt;pre id=&quot;code_1614430914130&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;@Component(&quot;needAdminInterceptor&quot;) // 컴포넌트 이름 설정
public class NeedAdminInterceptor implements HandlerInterceptor {
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
			throws Exception {

		// 이 인터셉터 실행 전에 beforeActionInterceptor 가 실행되고 거기서 isLogined 라는 속성 생성
		// 그래서 여기서 단순히 request.getAttribute(&quot;isLogined&quot;); 이것만으로 로그인 여부 알 수 있음
		boolean isAdmin = (boolean) request.getAttribute(&quot;isAdmin&quot;);

		// 이 인터셉터 실행 전에 beforeActionInterceptor 가 실행되고 거기서 isAjax 라는 속성 생성
		// 그래서 여기서 단순히 request.getAttribute(&quot;isAjax&quot;); 이것만으로 해당 요청이 ajax인지 구분 가능
		boolean isAjax = true;

		if (isAdmin == false) {
			if (isAjax == false) {
				response.setContentType(&quot;text/html; charset=UTF-8&quot;);
				response.getWriter().append(&quot;&amp;lt;script&amp;gt;&quot;);
				response.getWriter().append(&quot;alert('관리자만 이용해주세요.');&quot;);
				response.getWriter().append(&quot;location.replace('/usr/member/login?redirectUri=&quot;
						+ request.getAttribute(&quot;encodedAfterLoginUri&quot;) + &quot;');&quot;);
				response.getWriter().append(&quot;&amp;lt;/script&amp;gt;&quot;);
				// 리턴 false;를 이후에 실행될 인터셉터와 액션이 실행되지 않음
			} else {
				response.setContentType(&quot;application/json; charset=UTF-8&quot;);
				response.getWriter().append(&quot;{\&quot;resultCode\&quot;:\&quot;F-A\&quot;,\&quot;msg\&quot;:\&quot;관리자만 이용해주세요.\&quot;}&quot;);
			}

			return false;
		}

		return HandlerInterceptor.super.preHandle(request, response, handler);
	}
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;3.&amp;nbsp;needLoginInterceptor &lt;br /&gt;&amp;nbsp;&amp;nbsp;-&amp;nbsp;일반&amp;nbsp;사용자에&amp;nbsp;대한&amp;nbsp;모든&amp;nbsp;접속&amp;nbsp;정보를&amp;nbsp;한번&amp;nbsp;걸러준다&lt;/p&gt;
&lt;pre id=&quot;code_1614430934703&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;@Component(&quot;needLoginInterceptor&quot;) // 컴포넌트 이름 설정
public class NeedLoginInterceptor implements HandlerInterceptor {
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
			throws Exception {

		// 이 인터셉터 실행 전에 beforeActionInterceptor 가 실행되고 거기서 isLogined 라는 속성 생성
		// 그래서 여기서 단순히 request.getAttribute(&quot;isLogined&quot;); 이것만으로 로그인 여부 알 수 있음
		boolean isLogined = (boolean) request.getAttribute(&quot;isLogined&quot;);

		// 이 인터셉터 실행 전에 beforeActionInterceptor 가 실행되고 거기서 isAjax 라는 속성 생성
		// 그래서 여기서 단순히 request.getAttribute(&quot;isAjax&quot;); 이것만으로 해당 요청이 ajax인지 구분 가능
		boolean isAjax = true;

		if (isLogined == false) {
			if (isAjax == false) {
				response.setContentType(&quot;text/html; charset=UTF-8&quot;);
				response.getWriter().append(&quot;&amp;lt;script&amp;gt;&quot;);
				response.getWriter().append(&quot;alert('로그인 후 이용해주세요.');&quot;);
				response.getWriter().append(&quot;location.replace('/usr/member/login?redirectUri=&quot;
						+ request.getAttribute(&quot;encodedAfterLoginUri&quot;) + &quot;');&quot;);
				response.getWriter().append(&quot;&amp;lt;/script&amp;gt;&quot;);
				// 리턴 false;를 이후에 실행될 인터셉터와 액션이 실행되지 않음
			} else {
				response.setContentType(&quot;application/json; charset=UTF-8&quot;);
				response.getWriter().append(&quot;{\&quot;resultCode\&quot;:\&quot;F-A\&quot;,\&quot;msg\&quot;:\&quot;로그인 후 이용해주세요.\&quot;}&quot;);
			}

			return false;
		}

		return HandlerInterceptor.super.preHandle(request, response, handler);
	}
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;4.&amp;nbsp;needLogoutInterceptor &lt;br /&gt;&amp;nbsp;&amp;nbsp;-&amp;nbsp;일반&amp;nbsp;사용자에&amp;nbsp;대한&amp;nbsp;모든&amp;nbsp;접속&amp;nbsp;정보를&amp;nbsp;한번&amp;nbsp;걸러준다&lt;/p&gt;
&lt;pre id=&quot;code_1614430947694&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;@Component(&quot;needLogoutInterceptor&quot;) // 컴포넌트 이름 설정
public class NeedLogoutInterceptor implements HandlerInterceptor {
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
			throws Exception {
		// 이 인터셉터 실행 전에 beforeActionInterceptor 가 실행되고 거기서 isLogined 라는 속성 생성
		// 그래서 여기서 단순히 request.getAttribute(&quot;isLogined&quot;); 이것만으로 로그인 여부 알 수 있음
		boolean isLogined = (boolean) request.getAttribute(&quot;isLogined&quot;);

		boolean isAjax = true;

		if (isLogined) {
			if (isAjax == false) {
				response.setContentType(&quot;text/html; charset=UTF-8&quot;);
				response.getWriter().append(&quot;&amp;lt;script&amp;gt;&quot;);
				response.getWriter().append(&quot;location.replace('/usr/home/main');&quot;);
				response.getWriter().append(&quot;&amp;lt;/script&amp;gt;&quot;);
			} else {
				response.setContentType(&quot;application/json; charset=UTF-8&quot;);
				response.getWriter().append(&quot;{\&quot;resultCode\&quot;:\&quot;F-A\&quot;,\&quot;msg\&quot;:\&quot;로그아웃 상태에서 이용해주세요.\&quot;}&quot;);
			}
			// 리턴 false;를 이후에 실행될 인터셉터와 액션이 실행되지 않음
			return false;
		}

		return HandlerInterceptor.super.preHandle(request, response, handler);
	}
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre id=&quot;code_1614430987776&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    // beforeActionInterceptor 인터셉터 불러오기
    @Autowired
    @Qualifier(&quot;beforeActionInterceptor&quot;)
    HandlerInterceptor beforeActionInterceptor;

    // needAdmLoginInterceptor 인터셉터 불러오기
    @Autowired
    @Qualifier(&quot;needAdminInterceptor&quot;)
    HandlerInterceptor needAdminInterceptor;
    
    // needLoginInterceptor 인터셉터 불러오기
    @Autowired
    @Qualifier(&quot;needLoginInterceptor&quot;)
    HandlerInterceptor needLoginInterceptor;

    // needLogoutInterceptor 인터셉터 불러오기
    @Autowired
    @Qualifier(&quot;needLogoutInterceptor&quot;)
    HandlerInterceptor needLogoutInterceptor;

    // 이 함수는 인터셉터를 적용하는 역할을 합니다.
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
	// beforeActionInterceptor 인터셉터가 모든 액션 실행전에 실행되도록 처리
	registry.addInterceptor(beforeActionInterceptor)
		.addPathPatterns(&quot;/**&quot;)
		.excludePathPatterns(&quot;/resource/**&quot;);

	// 어드민 필요
	registry.addInterceptor(needAdminInterceptor)
		.addPathPatterns(&quot;/adm/**&quot;)
		.excludePathPatterns(&quot;/adm/member/login&quot;)
		.excludePathPatterns(&quot;/adm/member/doLogin&quot;);
	
	// 로그인 필요
	registry.addInterceptor(needLoginInterceptor)
        	.addPathPatterns(&quot;/**&quot;)
        	.excludePathPatterns(&quot;/&quot;)
        	.excludePathPatterns(&quot;/adm/**&quot;)
        	.excludePathPatterns(&quot;/resource/**&quot;)
        	.excludePathPatterns(&quot;/usr/home/main&quot;)
        	.excludePathPatterns(&quot;/usr/member/login&quot;)
        	.excludePathPatterns(&quot;/usr/member/doLogin&quot;)
        	.excludePathPatterns(&quot;/usr/member/join&quot;)
        	.excludePathPatterns(&quot;/usr/member/doJoin&quot;)
        	.excludePathPatterns(&quot;/usr/article/list&quot;)
        	.excludePathPatterns(&quot;/usr/article/detail&quot;)
        	.excludePathPatterns(&quot;/usr/reply/list&quot;)
        	.excludePathPatterns(&quot;/usr/member/findLoginId&quot;)
        	.excludePathPatterns(&quot;/usr/member/doFindLoginId&quot;)
        	.excludePathPatterns(&quot;/usr/member/findLoginPw&quot;)
        	.excludePathPatterns(&quot;/usr/member/doFindLoginPw&quot;)
        	.excludePathPatterns(&quot;/usr/file/test*&quot;)
        	.excludePathPatterns(&quot;/usr/file/doTest*&quot;)
        	.excludePathPatterns(&quot;/test/**&quot;)
        	.excludePathPatterns(&quot;/error&quot;);

	// 로그인 상태에서 접속할 수 없는 URI 전부 기술
	registry.addInterceptor(needLogoutInterceptor)
		.addPathPatterns(&quot;/adm/member/login&quot;)
    	    	.addPathPatterns(&quot;/adm/member/doLogin&quot;)
    		.addPathPatterns(&quot;/usr/member/login&quot;)
    		.addPathPatterns(&quot;/usr/member/doLogin&quot;)
    		.addPathPatterns(&quot;/usr/member/join&quot;)
    		.addPathPatterns(&quot;/usr/member/doJoin&quot;);
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;아직 개발 초기 단계라 비교적 소스코드가 간결할때 기록 하기에 이해하기 어렵지 않을거라 생각합니다.&lt;/p&gt;
&lt;p&gt;혹시라도 잘못된 문법이나 궁금한게 있다면 댓글로 남겨주세요 ~~&amp;nbsp;&lt;/p&gt;</description>
      <category>Java</category>
      <author>디케이형</author>
      <guid isPermaLink="true">https://d8040.tistory.com/202</guid>
      <comments>https://d8040.tistory.com/202#entry202comment</comments>
      <pubDate>Sat, 27 Feb 2021 22:04:46 +0900</pubDate>
    </item>
    <item>
      <title>[Java] 추상클래스와 인터페이스 차이</title>
      <link>https://d8040.tistory.com/201</link>
      <description>&lt;div class=&quot;tt_article_useless_p_margin&quot;&gt;
&lt;h3 id=&quot;추상클래스인터페이스왜사용할까_0&quot; data-ke-size=&quot;size23&quot;&gt;추상클래스 인터페이스 왜... 사용할까?&lt;/h3&gt;
&lt;p&gt;우리는 추상클래스와 인터페이스에 대해서 알고 있냐고 누가 물어본다면 알고 있다고 대답을 하고있습니다. 그런데 이론적인 내용 말고 정작 &lt;b&gt;&quot;왜 사용하나요?&quot;&lt;/b&gt;, &lt;b&gt;&quot;차이점이 뭔가요?&quot;&lt;/b&gt;, &lt;b&gt;&quot;추상클래스를 사용할지 인터페이스를 사용할지 어떻게 정하나요?&quot; &lt;/b&gt;이런 실무적인 질문이 들어오면 시원하게 대답하기가 생각보다 힘들겁니다. 힘드셨기 때문에 지금 이 글을 읽고 계실거라고 생각합니다. &lt;u&gt;저도 마찬가지였고 단순히 추상클래스와 인터페이스가 무엇인지 보다 왜 사용하는지가 궁금하셨다면 아래 제 생각들을 천천히 읽어주시면 도움이 될 수 있을것이라 생각합니다.&lt;/u&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;일단 기본적으로 추상클래스와 인터페이스가 무엇인지 알아봅시다.&lt;/p&gt;
&lt;h3 id=&quot;추상클래스란_1&quot; data-ke-size=&quot;size23&quot;&gt;추상클래스란?&lt;/h3&gt;
&lt;p&gt;추상클래스는 일반 클래스와 별 다를 것이 없습니다. 단지, 추상 메서드를 선언하여 &lt;b&gt;상속을 통해서 자손 클래스에서 완성하도록 유도&lt;/b&gt;하는 클래스입니다. 그래서 &lt;b&gt;미완성 설계도&lt;/b&gt;라고도 표현합니다. &lt;u&gt;상속을 위한 클래스이기 때문에 따로 객체를 생성할 수 없습니다.&lt;/u&gt;&lt;/p&gt;
&lt;p&gt;class 앞에 &quot;abstract&quot; 예약어를 사용하여 상속을 통해서 구현해야한다는 것을 알려주고 선언부만 작성하는 추상메서드를 선언할 수 있습니다.&lt;/p&gt;
&lt;div class=&quot;colorscripter-code&quot; style=&quot;color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; position: relative !important; overflow: auto;&quot;&gt;
&lt;table class=&quot;colorscripter-code-table&quot; style=&quot;margin: 0px; padding: 0px; border: none; background-color: #272727; border-radius: 4px; width: 0px;&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;padding: 6px; border-right: 2px solid #4f4f4f; width: 25px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; word-break: normal; text-align: right; color: #aaa; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;1&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;2&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;3&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;4&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;padding: 6px 0px; text-align: left; width: 332px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;abstract&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;class&lt;/span&gt;&amp;nbsp;클래스이름&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;abstract&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;메서드이름();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;}&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 id=&quot;인터페이스란_2&quot; data-ke-size=&quot;size23&quot;&gt;인터페이스란?&lt;/h3&gt;
&lt;p&gt;추상클래스가 미완성 설계도라면 인터페이스는 &lt;b&gt;기본 설계도&lt;/b&gt;라고 할 수 있습니다. 인터페이스도 추상클래스처럼 다른 클래스를 작성하는데 도움을 주는 목적으로 작성하고 클래스와 다르게 &lt;b&gt;다중상속(구현)&lt;/b&gt;이 가능합니다.&lt;/p&gt;
&lt;div class=&quot;colorscripter-code&quot; style=&quot;color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; position: relative !important; overflow: auto;&quot;&gt;
&lt;table class=&quot;colorscripter-code-table&quot; style=&quot;margin: 0px; padding: 0px; border: none; background-color: #272727; border-radius: 4px; width: 0px;&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;padding: 6px; border-right: 2px solid #4f4f4f; width: 25px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; word-break: normal; text-align: right; color: #aaa; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;1&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;2&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;3&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;4&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;padding: 6px 0px; text-align: left; width: 332px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;interface&lt;/span&gt;&amp;nbsp;인터페이스이름&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;static&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;final&lt;/span&gt;&amp;nbsp;상수이름&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;=&lt;/span&gt;&amp;nbsp;값;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;abstract&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;메서드이름();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;}&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 id=&quot;추상클래스VS인터페이스차이점_3&quot; data-ke-size=&quot;size23&quot;&gt;추상클래스 VS 인터페이스 차이점&lt;/h3&gt;
&lt;p&gt;추상클래스와 인터페이스의 공통점은 추상메서드를 사용할 수 있다는 것입니다. 그럼 &lt;b&gt;왜 굳이 2가지로 나눠서 사용할까요?&lt;/b&gt; 추상클래스와 인터페이스의 기능들을 살펴보면 &lt;b&gt;추상클래스가 인터페이스의 역할을 다 할 수 있는데 왜 굳이 인터페이스라는게 있는 걸까요?&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;이론적인 차이점을 다 제외하고 두개로 나눠서 사용하는 가장 큰 차이점은 &lt;b&gt;사용용도&lt;/b&gt;라고 생각합니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4 id=&quot;1사용의도차이점_4&quot; data-ke-size=&quot;size20&quot;&gt;1. 사용의도 차이점&lt;/h4&gt;
&lt;p&gt;&lt;b&gt;추상클래스는 IS - A &quot;~이다&quot;.&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;인터페이스는 HAS - A &quot;~을 할 수 있는&quot;.&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;이렇게 구분하는 이유는 다중상속의 가능 여부에 따라 용도를 정한 것 같습니다. 자바의 특성상 한개의 클래스만 상속이 가능하여 해당 클래스의 구분을 추상클래스 상속을 통해 해결하고, 할 수 있는 기능들을 인터페이스로 구현합니다.&lt;/p&gt;
&lt;p&gt;이렇게 글로 표현하여 이해가 어려울 수 있습니다. 아래 예제를 통해 더 자세하게 설명하겠습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4 id=&quot;2공통된기능사용여부_5&quot; data-ke-size=&quot;size20&quot;&gt;2. 공통된 기능 사용 여부&lt;/h4&gt;
&lt;p&gt;만약 모든 클래스가 &lt;b&gt;인터페이스를 사용해서 기본 틀을 구성한다면... 공통으로 필요한 기능들도 모든 클래스에서 오버라이딩 하여 재정의 해야하는 번거로움이 있습니다.&lt;/b&gt; 이렇게 공통된 기능이 필요하다면 추상클래스를 이용해서 일반 메서드를 작성하여 자식 클래스에서 사용할 수 있도록 하면 된다. 어!? 그러면 그냥 추상클래스만 사용하면 되는 거 아닌가요? 위에서 얘기 했듯이 자바는 하나의 클래스만 상속이 가능합니다. 만약 각각 다른 추상클래스를 상속하는데 공통된 기능이 필요하다면? 해당 기능을 인터페이스로 작성해서 구현하는게 편하겠죠?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;아무래도 글로만 설명하는데는 한계가 있는 것 같습니다. 아래 예제를 통해 어떻게 언제 무엇을 사용해야할지 알아 보도록 합시다.&lt;/p&gt;
&lt;h3 id=&quot;추상클래스인터페이스예제생명체_6&quot; data-ke-size=&quot;size23&quot;&gt;추상클래스 인터페이스 예제 (생명체)&lt;/h3&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;제목 없는 프레젠테이션.png&quot; data-origin-width=&quot;848&quot; data-origin-height=&quot;361&quot;&gt;
&lt;div class=&quot;img-with-description  text-center&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bstzKQ/btqBSPHUrzK/KpjOscUdnrMyOyJrWilSH1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbstzKQ%2FbtqBSPHUrzK%2FKpjOscUdnrMyOyJrWilSH1%2Fimg.png&quot; data-filename=&quot;제목 없는 프레젠테이션.png&quot; data-origin-width=&quot;848&quot; data-origin-height=&quot;361&quot; /&gt;&lt;span class=&quot;img-description&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/figure&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;위와 같은 관계를 갖는 예제를 만들어 보겠습니다. 인간과 동물은 생명체를 상속하고 각 생명체들은 구분에 따라 인간과 동물을 상속합니다. 그리고 각각 할 수 있는 기능들을 인터페이스로 구현했습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4 id=&quot;Creature추상클래스_7&quot; data-ke-size=&quot;size20&quot;&gt;Creature 추상클래스&lt;/h4&gt;
&lt;div class=&quot;colorscripter-code&quot; style=&quot;color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; position: relative !important; overflow: auto;&quot;&gt;
&lt;table class=&quot;colorscripter-code-table&quot; style=&quot;margin: 0px; padding: 0px; border: none; background-color: #272727; border-radius: 4px; width: 0px;&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;padding: 6px; border-right: 2px solid #4f4f4f; width: 34px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; word-break: normal; text-align: right; color: #aaa; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;1&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;2&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;3&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;4&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;5&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;6&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;7&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;8&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;9&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;10&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;11&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;12&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;13&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;14&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;15&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;16&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;17&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;18&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;19&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;20&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;21&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;22&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;23&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;24&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;25&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;26&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;27&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;28&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;29&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;30&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;31&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;32&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;33&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;34&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;35&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;36&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;37&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;38&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;39&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;40&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;padding: 6px 0px; text-align: left; width: 556px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;abstract&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;class&lt;/span&gt;&amp;nbsp;Creature&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;private&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;x;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;private&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;y;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;private&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;age;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;Creature(&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;x,&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;y,&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;age)&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;this&lt;/span&gt;.age&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;=&lt;/span&gt;&amp;nbsp;age;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;this&lt;/span&gt;.x&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;=&lt;/span&gt;&amp;nbsp;x;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;this&lt;/span&gt;.y&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;=&lt;/span&gt;&amp;nbsp;y;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;age()&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;age&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;+&lt;/span&gt;;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;move(&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;xDistance)&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;=&lt;/span&gt;&amp;nbsp;xDistance;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;getX()&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;return&lt;/span&gt;&amp;nbsp;x;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;setX(&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;x)&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;this&lt;/span&gt;.x&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;=&lt;/span&gt;&amp;nbsp;x;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;getY()&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;return&lt;/span&gt;&amp;nbsp;y;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;setY(&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;y)&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;this&lt;/span&gt;.y&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;=&lt;/span&gt;&amp;nbsp;y;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;abstract&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;attack();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;abstract&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;printInfo();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@Override&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;String&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;toString&lt;/span&gt;()&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ffd500;&quot;&gt;&quot;x&amp;nbsp;:&amp;nbsp;&quot;&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;+&lt;/span&gt;&amp;nbsp;x&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ffd500;&quot;&gt;&quot;,&amp;nbsp;y&amp;nbsp;:&amp;nbsp;&quot;&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;+&lt;/span&gt;&amp;nbsp;y&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ffd500;&quot;&gt;&quot;,&amp;nbsp;age&amp;nbsp;:&amp;nbsp;&quot;&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;+&lt;/span&gt;&amp;nbsp;age;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;}&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: right; margin-top: -13px; margin-right: 5px; font-size: 9px; font-style: italic;&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;기본적으로 생명체가 갖는 요소로 위치 &lt;b&gt;x, y그리고 age&lt;/b&gt; 나이가 필요하다고 생각하여 선언했고 생성자가 만들어 질때 이 3가지 요소는 받아서 넣을 수 있도록 했습니다. toString 메서드는 나중에 출력은 간편하게 하기 위해서 오버라이딩하여 사용했습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class=&quot;colorscripter-code&quot; style=&quot;color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; position: relative !important; overflow: auto;&quot;&gt;
&lt;table class=&quot;colorscripter-code-table&quot; style=&quot;margin: 0px; padding: 0px; border: none; background-color: #272727; border-radius: 4px; width: 0px;&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;padding: 6px; border-right: 2px solid #4f4f4f; width: 25px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; word-break: normal; text-align: right; color: #aaa; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;1&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;2&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;3&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;4&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;5&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;6&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;7&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;padding: 6px 0px; text-align: left; width: 313px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;age()&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;age&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;+&lt;/span&gt;;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;move(&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;xDistance)&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;=&lt;/span&gt;&amp;nbsp;xDistance;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;}&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: right; margin-top: -13px; margin-right: 5px; font-size: 9px; font-style: italic;&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;생명체라면 &lt;b&gt;나이를 먹고 x좌표상으로 이동 할 수 있는 부분이 공통 적인 기능이기 때문에 하위 클래스에서 상속할 수 있도록 일반 메서드&lt;/b&gt;로 구현했습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class=&quot;colorscripter-code&quot; style=&quot;color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; position: relative !important; overflow: auto;&quot;&gt;
&lt;table class=&quot;colorscripter-code-table&quot; style=&quot;margin: 0px; padding: 0px; border: none; background-color: #272727; border-radius: 4px; width: 0px;&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;padding: 6px; border-right: 2px solid #4f4f4f; width: 25px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; word-break: normal; text-align: right; color: #aaa; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;1&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;2&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;padding: 6px 0px; text-align: left; width: 313px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;abstract&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;attack();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;abstract&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;printInfo();&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;추상메서드로는 공격하는 기능과 정보를 출력하는 기능을 선언했습니다. &lt;b&gt;모든 생명체에 필요한 기능이지만 각각 생명체에 따라 다른 기능으로 구현을 해야하기 때문에 위 두 메서드는 추상메서드로 선언&lt;/b&gt;하여 하위클래스에서 처리하도록 한 것입니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4 id=&quot;Animal추상클래스_8&quot; data-ke-size=&quot;size20&quot;&gt;Animal 추상클래스&lt;/h4&gt;
&lt;div class=&quot;colorscripter-code&quot; style=&quot;color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; position: relative !important; overflow: auto;&quot;&gt;
&lt;table class=&quot;colorscripter-code-table&quot; style=&quot;margin: 0px; padding: 0px; border: none; background-color: #272727; border-radius: 4px; width: 0px;&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;padding: 6px; border-right: 2px solid #4f4f4f; width: 34px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; word-break: normal; text-align: right; color: #aaa; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;1&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;2&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;3&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;4&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;5&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;6&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;7&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;8&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;9&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;10&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;11&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;padding: 6px 0px; text-align: left; width: 434px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;abstract&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;class&lt;/span&gt;&amp;nbsp;Animal&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;extends&lt;/span&gt;&amp;nbsp;Creature{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;Animal(&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;x,&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;y,&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;age)&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;super&lt;/span&gt;(x,&amp;nbsp;y,&amp;nbsp;age);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@Override&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;attack()&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #4be6fa;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #4be6fa;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #ffd500;&quot;&gt;&quot;몸을&amp;nbsp;사용하여&amp;nbsp;공격!!&quot;&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;}&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: right; margin-top: -13px; margin-right: 5px; font-size: 9px; font-style: italic;&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;동물 클래서는 생명체이기 때문에&amp;nbsp; Creature 추상클래스를 상속했습니다. 동물은 몸을 사용하여 공경하기 때문에 추상메서드 중에 attack메서드를 오버라이딩 하였습니다. 지금까지 추상클래스에 대한 이해를 다 하셨다면 코드상 이상한 부분이 집힐겁니다. 바로 &lt;b&gt;printInfo 메서드도 추상메서드인데 왜 동물 클래스에는 없는 걸까요??&lt;/b&gt; 이 이유는 하나 더 내린 것입니다. 생명체 클래스도 동물 클래스도 추상클래스입니다. &lt;b&gt;즉 상위 클래스에서 선언한 추상메서드를 앞으로 동물 클래스를 상속할 클래스에게 위임&lt;/b&gt;한 것입니다. 동물 클래스도 추상클래스이기 때문에 위처럼 사용이 가능합니다. 추상클래스는 상속을 위한 클래스이니까!!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4 id=&quot;Human추상클래스_9&quot; data-ke-size=&quot;size20&quot;&gt;Human 추상클래스&lt;/h4&gt;
&lt;div class=&quot;colorscripter-code&quot; style=&quot;color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; position: relative !important; overflow: auto;&quot;&gt;
&lt;table class=&quot;colorscripter-code-table&quot; style=&quot;margin: 0px; padding: 0px; border: none; background-color: #272727; border-radius: 4px; width: 0px;&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;padding: 6px; border-right: 2px solid #4f4f4f; width: 34px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; word-break: normal; text-align: right; color: #aaa; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;1&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;2&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;3&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;4&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;5&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;6&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;7&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;8&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;9&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;10&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;11&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;12&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;13&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;14&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;15&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;padding: 6px 0px; text-align: left; width: 602px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;abstract&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;class&lt;/span&gt;&amp;nbsp;Human&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;extends&lt;/span&gt;&amp;nbsp;Creature&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;implements&lt;/span&gt;&amp;nbsp;Talkable{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;Human(&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;x,&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;y,&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;age)&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;super&lt;/span&gt;(x,&amp;nbsp;y,&amp;nbsp;age);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@Override&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;attack()&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #4be6fa;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #4be6fa;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #ffd500;&quot;&gt;&quot;도구를&amp;nbsp;사용!!&quot;&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@Override&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;talk()&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #4be6fa;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #4be6fa;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #ffd500;&quot;&gt;&quot;사람은&amp;nbsp;말을&amp;nbsp;할&amp;nbsp;수&amp;nbsp;있다.&quot;&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;}&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: right; margin-top: -13px; margin-right: 5px; font-size: 9px; font-style: italic;&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;인간 클래스도 마찬가지로 attack 추상메서드는 구현해주고, printInfo 추상메서드는 아래로 위임한 것입니다. 인간 클래스는 동물 클래스와 다르게 Talkable 인터페이스를 구현했습니다.&amp;nbsp; &lt;b&gt;예상할 수 있듯이 Talkable 인터페이스에서는 talk메서드가 추상메서드로 있겠죠?&lt;/b&gt; 추상클래스도 인터페이스를 구현할 수 있는 것을 보면 정말 일반클래스와 크게 차이가 없다는 것을 알 수 있습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4 id=&quot;Talkable인터페이스_10&quot; data-ke-size=&quot;size20&quot;&gt;Talkable 인터페이스&lt;/h4&gt;
&lt;div class=&quot;colorscripter-code&quot; style=&quot;color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; position: relative !important; overflow: auto;&quot;&gt;
&lt;table class=&quot;colorscripter-code-table&quot; style=&quot;margin: 0px; padding: 0px; border: none; background-color: #272727; border-radius: 4px; width: 0px;&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;padding: 6px; border-right: 2px solid #4f4f4f; width: 25px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; word-break: normal; text-align: right; color: #aaa; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;1&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;2&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;3&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;padding: 6px 0px; text-align: left; width: 258px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;interface&lt;/span&gt;&amp;nbsp;Talkable&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;abstract&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;talk();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;}&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Talkable 인터페이스에서는 크게 다룰 것 없이 추상메서드를 하나만 선언 했습니다. 제가 작성하는 인터페이스들의 명명 규칙을 보시면 아시겠지만 ~able로 끝나는 인터페이스들이 많습니다. 모든 인터페이스가 다 그런 것은 아니지만 &quot;~를 할 수 있는&quot; 클래스라는 것은 명시해주기 위해 사용됩니다. ex) Parsable, Comparable...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4 id=&quot;Flyable인터페이스_11&quot; data-ke-size=&quot;size20&quot;&gt;Flyable 인터페이스&lt;/h4&gt;
&lt;div class=&quot;colorscripter-code&quot; style=&quot;color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; position: relative !important; overflow: auto;&quot;&gt;
&lt;table class=&quot;colorscripter-code-table&quot; style=&quot;margin: 0px; padding: 0px; border: none; background-color: #272727; border-radius: 4px; width: 0px;&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;padding: 6px; border-right: 2px solid #4f4f4f; width: 25px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; word-break: normal; text-align: right; color: #aaa; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;1&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;2&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;3&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;4&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;padding: 6px 0px; text-align: left; width: 439px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;interface&lt;/span&gt;&amp;nbsp;Flyable&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;fly(&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;yDistance);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;flyMove(&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;xDistance,&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;yDistance);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;}&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: right; margin-top: -13px; margin-right: 5px; font-size: 9px; font-style: italic;&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;다음은 새 종류의 동물 클래스에 구현시킬 Flyable 인터페이스입니다. 다른 동물들과는 다르게 y행으로 위로 올라갈 수 있도록 하는 메서드들을 선언했습니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4 id=&quot;Pigeon일반클래스_12&quot; data-ke-size=&quot;size20&quot;&gt;Pigeon 일반클래스&lt;/h4&gt;
&lt;div class=&quot;colorscripter-code&quot; style=&quot;color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; position: relative !important; overflow: auto;&quot;&gt;
&lt;table class=&quot;colorscripter-code-table&quot; style=&quot;margin: 0px; padding: 0px; border: none; background-color: #272727; border-radius: 4px; width: 0px;&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;padding: 6px; border-right: 2px solid #4f4f4f; width: 34px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; word-break: normal; text-align: right; color: #aaa; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;1&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;2&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;3&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;4&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;5&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;6&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;7&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;8&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;9&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;10&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;11&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;12&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;13&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;14&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;15&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;16&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;17&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;18&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;19&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;20&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;21&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;padding: 6px 0px; text-align: left; width: 511px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;class&lt;/span&gt;&amp;nbsp;Pigeon&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;extends&lt;/span&gt;&amp;nbsp;Animal&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;implements&lt;/span&gt;&amp;nbsp;Flyable{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;Pigeon(&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;x,&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;y,&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;age)&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;super&lt;/span&gt;(x,&amp;nbsp;y,&amp;nbsp;age);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@Override&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;fly(&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;yDistance)&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;setY(getY()&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;+&lt;/span&gt;&amp;nbsp;yDistance);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@Override&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;flyMove(&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;xDistance,&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;yDistance)&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;setY(getY()&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;+&lt;/span&gt;&amp;nbsp;yDistance);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;setX(getX()&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;+&lt;/span&gt;&amp;nbsp;xDistance);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@Override&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;printInfo()&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #4be6fa;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #4be6fa;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #ffd500;&quot;&gt;&quot;Pigeon&amp;nbsp;-&amp;gt;&amp;nbsp;&quot;&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;toString&lt;/span&gt;());&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;}&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: right; margin-top: -13px; margin-right: 5px; font-size: 9px; font-style: italic;&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;비둘기 클래스는 일반 클래스입니다. 동물 클래스를 상속하고 날수 있는 동물이기에 Flyable 인터페이스를 구현해주고 해당 메서드들을 구현 해 주었습니다. printInfo 메서드를 보시면 이전에 Creature클래서의 추상메서드를 오버라이딩 해주었죠?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4 id=&quot;Swimable인터페이스_13&quot; data-ke-size=&quot;size20&quot;&gt;Swimable 인터페이스&lt;/h4&gt;
&lt;div class=&quot;colorscripter-code&quot; style=&quot;color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; position: relative !important; overflow: auto;&quot;&gt;
&lt;table class=&quot;colorscripter-code-table&quot; style=&quot;margin: 0px; padding: 0px; border: none; background-color: #272727; border-radius: 4px; width: 0px;&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;padding: 6px; border-right: 2px solid #4f4f4f; width: 25px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; word-break: normal; text-align: right; color: #aaa; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;1&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;2&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;3&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;padding: 6px 0px; text-align: left; width: 313px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;interface&lt;/span&gt;&amp;nbsp;Swimable&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt; swimDown(&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;yDistance);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;}&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Swimable 인터페이스입니다. 이 인터페이스는 차이점에서 &lt;b&gt;2. 공통된 기능 사용여부&lt;/b&gt;와 관련된 인터페이스입니다. 저는 앞으로 거북이와 케빈이라는 클래스를 작성할겁니다. 거북이는 동물이고 케빈은 사람입니다. 그런데 두 생명체 모두 수영을 할 수 있습니다. &lt;b&gt;이런경우 생명체 클래스에다가 swinDown 추상메서드를 만들어 주어야하나? 아니면 각각 동물과 사람 클래스에 추상메서드를 만들어 주어야하나? 음... 하지만 동물이나 사람중에서 수영을 못하는 사람이 있을 수도 있다!? 바로 이런 경우에 인터페이스로 다로 선언을 해줘서 각각 수영을 할 수 있는 클래스에 구현시켜줘서 만들어 주면 가독성도 좋고 유지보수하는 측면에서도 뛰어나겠죠??&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4 id=&quot;Turtle일반클래스_14&quot; data-ke-size=&quot;size20&quot;&gt;Turtle 일반클래스&lt;/h4&gt;
&lt;div class=&quot;colorscripter-code&quot; style=&quot;color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; position: relative !important; overflow: auto;&quot;&gt;
&lt;table class=&quot;colorscripter-code-table&quot; style=&quot;margin: 0px; padding: 0px; border: none; background-color: #272727; border-radius: 4px; width: 0px;&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;padding: 6px; border-right: 2px solid #4f4f4f; width: 34px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; word-break: normal; text-align: right; color: #aaa; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;1&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;2&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;3&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;4&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;5&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;6&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;7&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;8&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;9&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;10&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;11&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;12&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;13&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;14&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;15&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;padding: 6px 0px; text-align: left; width: 511px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;class&lt;/span&gt;&amp;nbsp;Turtle&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;extends&lt;/span&gt;&amp;nbsp;Animal&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;implements&lt;/span&gt;&amp;nbsp;Swimable{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;Turtle(&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;x,&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;y,&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;age)&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;super&lt;/span&gt;(x,&amp;nbsp;y,&amp;nbsp;age);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@Override&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt; swimDown(&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;yDistance)&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;setY(getY()&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;-&lt;/span&gt;&amp;nbsp;yDistance);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@Override&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;printInfo()&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #4be6fa;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #4be6fa;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #ffd500;&quot;&gt;&quot;Turtle&amp;nbsp;-&amp;gt;&amp;nbsp;&quot;&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;toString&lt;/span&gt;());&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;}&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: right; margin-top: -13px; margin-right: 5px; font-size: 9px; font-style: italic;&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;거북이 클래스에서 아래로 수영할 수 있는 기능을 재정의 해주고&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4 id=&quot;Kevin일반클래스_15&quot; data-ke-size=&quot;size20&quot;&gt;Kevin 일반클래스&lt;/h4&gt;
&lt;div class=&quot;colorscripter-code&quot; style=&quot;color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; position: relative !important; overflow: auto;&quot;&gt;
&lt;table class=&quot;colorscripter-code-table&quot; style=&quot;margin: 0px; padding: 0px; border: none; background-color: #272727; border-radius: 4px; width: 0px;&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;padding: 6px; border-right: 2px solid #4f4f4f; width: 34px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; word-break: normal; text-align: right; color: #aaa; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;1&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;2&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;3&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;4&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;5&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;6&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;7&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;8&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;9&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;10&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;11&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;12&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;13&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;14&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;15&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;16&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;17&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;18&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;19&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;20&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;21&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;22&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;23&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;padding: 6px 0px; text-align: left; width: 602px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;class&lt;/span&gt;&amp;nbsp;Kevin&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;extends&lt;/span&gt;&amp;nbsp;Human&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;implements&lt;/span&gt;&amp;nbsp;Programmer,&amp;nbsp;Swimable{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;Kevin(&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;x,&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;y,&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;age)&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;super&lt;/span&gt;(x,&amp;nbsp;y,&amp;nbsp;age);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@Override&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;coding()&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #4be6fa;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #4be6fa;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #ffd500;&quot;&gt;&quot;Hello&amp;nbsp;World!&quot;&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@Override&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt; swimDown(&lt;span style=&quot;color: #4be6fa;&quot;&gt;int&lt;/span&gt;&amp;nbsp;yDistance)&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;setY(getY()&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;-&lt;/span&gt;&amp;nbsp;yDistance);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;if&lt;/span&gt;(getY()&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;&amp;lt;&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #c10aff;&quot;&gt;10&lt;/span&gt;)&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #4be6fa;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #4be6fa;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #ffd500;&quot;&gt;&quot;너무&amp;nbsp;깊이&amp;nbsp;들어가면&amp;nbsp;죽을수도&amp;nbsp;있어!!&quot;&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@Override&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;printInfo()&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #4be6fa;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #4be6fa;&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #ffd500;&quot;&gt;&quot;Kevin&amp;nbsp;-&amp;gt;&amp;nbsp;&quot;&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;toString&lt;/span&gt;());&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;}&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: right; margin-top: -13px; margin-right: 5px; font-size: 9px; font-style: italic;&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Kevin클래스에서도 오버라이딩하여 재정의 해줄 수 있다. 케빈 같은 경우는 y값이 -10이하로 내려가면 죽을 수도 있다는 것을 알려주는 또 다른 기능으로 재정의 했습니다. &lt;b&gt;바로 이런 부분에서는 추상클래스 말고 인터페이스를 사용하는 것이 좋겠죠??&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;그리고 또다른 인터페이스의 장점! &lt;b&gt;바로 다중구현!&lt;/b&gt; Kevin은 수영도 할 수 있고 코딩도 할 수 있습니다. 그래서 Programmer와 Swimable 인터페이스를 모두 구현하고 필요한 메서드를 재정의해서 사용하면 됩니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4 id=&quot;Programmer인터페이스_16&quot; data-ke-size=&quot;size20&quot;&gt;Programmer 인터페이스&lt;/h4&gt;
&lt;div class=&quot;colorscripter-code&quot; style=&quot;color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; position: relative !important; overflow: auto;&quot;&gt;
&lt;table class=&quot;colorscripter-code-table&quot; style=&quot;margin: 0px; padding: 0px; border: none; background-color: #272727; border-radius: 4px; width: 0px;&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;padding: 6px; border-right: 2px solid #4f4f4f; width: 25px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; word-break: normal; text-align: right; color: #aaa; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;1&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;2&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;3&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;padding: 6px 0px; text-align: left; width: 276px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;interface&lt;/span&gt;&amp;nbsp;Programmer&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;coding();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;}&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4 id=&quot;Main실행클래스_17&quot; data-ke-size=&quot;size20&quot;&gt;Main 실행클래스&lt;/h4&gt;
&lt;div class=&quot;colorscripter-code&quot; style=&quot;color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; position: relative !important; overflow: auto;&quot;&gt;
&lt;table class=&quot;colorscripter-code-table&quot; style=&quot;margin: 0px; padding: 0px; border: none; background-color: #272727; border-radius: 4px; width: 0px;&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;padding: 6px; border-right: 2px solid #4f4f4f; width: 34px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; word-break: normal; text-align: right; color: #aaa; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;1&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;2&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;3&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;4&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;5&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;6&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;7&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;8&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;9&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;10&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;11&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;12&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;13&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;14&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;15&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;16&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;17&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;18&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;19&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;20&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;21&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;22&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;23&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;24&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;25&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;26&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;27&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;28&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;29&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;30&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;31&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;32&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;33&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;34&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;35&lt;/div&gt;
&lt;div style=&quot;line-height: 130%;&quot;&gt;36&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;padding: 6px 0px; text-align: left; width: 430px;&quot;&gt;
&lt;div style=&quot;margin: 0; padding: 0; color: #f0f0f0; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height: 130%;&quot;&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;class&lt;/span&gt;&amp;nbsp;Main&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;static&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;void&lt;/span&gt;&amp;nbsp;main(&lt;span style=&quot;color: #4be6fa;&quot;&gt;String&lt;/span&gt;[]&amp;nbsp;args)&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Pigeon&amp;nbsp;p&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Pigeon(&lt;span style=&quot;color: #c10aff;&quot;&gt;5&lt;/span&gt;,&lt;span style=&quot;color: #c10aff;&quot;&gt;10&lt;/span&gt;,&lt;span style=&quot;color: #c10aff;&quot;&gt;14&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p.printInfo();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p.age();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p.move(&lt;span style=&quot;color: #c10aff;&quot;&gt;100&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p.printInfo();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p.fly(&lt;span style=&quot;color: #c10aff;&quot;&gt;5&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p.printInfo();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p.flyMove(&lt;span style=&quot;color: #c10aff;&quot;&gt;10&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #c10aff;&quot;&gt;20&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p.printInfo();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p.attack();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #4be6fa;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #4be6fa;&quot;&gt;println&lt;/span&gt;();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Kevin&amp;nbsp;kev&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Kevin(&lt;span style=&quot;color: #c10aff;&quot;&gt;0&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #c10aff;&quot;&gt;0&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #c10aff;&quot;&gt;35&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;kev.printInfo();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;kev.age();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;kev.move(&lt;span style=&quot;color: #c10aff;&quot;&gt;10&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;kev.printInfo();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;kev.attack();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;kev.coding();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;kev.swimDown(&lt;span style=&quot;color: #c10aff;&quot;&gt;20&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;kev.printInfo();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;kev.talk();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #4be6fa;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #4be6fa;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #4be6fa;&quot;&gt;println&lt;/span&gt;();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Turtle&amp;nbsp;tur&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff3399;&quot;&gt;new&lt;/span&gt;&amp;nbsp;Turtle(&lt;span style=&quot;color: #c10aff;&quot;&gt;100&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #c10aff;&quot;&gt;10&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #c10aff;&quot;&gt;95&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tur.printInfo();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tur.age();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tur.move(&lt;span style=&quot;color: #0086b3;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #ff3399;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #c10aff;&quot;&gt;100&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tur.printInfo();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tur.attack();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tur.swimDown(&lt;span style=&quot;color: #c10aff;&quot;&gt;1000&lt;/span&gt;);&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tur.printInfo();&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;padding: 0 6px; white-space: pre; line-height: 130%;&quot;&gt;}&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: right; margin-top: -13px; margin-right: 5px; font-size: 9px; font-style: italic;&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;설계한 대로 코드를 작성했으니... 이제 확인 해봐야겠죠?&lt;/p&gt;
&lt;h4 id=&quot;실행결과_18&quot; data-ke-size=&quot;size20&quot;&gt;실행결과&lt;/h4&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; data-filename=&quot;스크린샷 2020-02-08 오후 4.45.20.png&quot; data-origin-width=&quot;490&quot; data-origin-height=&quot;548&quot;&gt;
&lt;div class=&quot;img-with-description  text-center&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/VhNrC/btqBNlhZuKs/4AWSUWS7R063FGe6micG8k/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FVhNrC%2FbtqBNlhZuKs%2F4AWSUWS7R063FGe6micG8k%2Fimg.png&quot; data-filename=&quot;스크린샷 2020-02-08 오후 4.45.20.png&quot; data-origin-width=&quot;490&quot; data-origin-height=&quot;548&quot; /&gt;&lt;span class=&quot;img-description&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/figure&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;위 예시처럼 직접 사용해서 다른 예시를 만들어 주면 인터페이스와 추상클래스의 차이점과 상황별 어떤 것을 사용해야할지 감이 올것 같아요. 저도 나름대로 공부하고 실습을 통해 추상클래스와 인터페이스에 대한 정리를 해봤는데 맞고 틀린 부분들도 분명 존재할 것이라고 생가각합니다. 정정 및 위 내용에 추가하고 싶은 것이 있다면 댓글 꼭 남겨주세요!!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4 id=&quot;정리_19&quot; data-ke-size=&quot;size20&quot;&gt;정리&lt;/h4&gt;
&lt;p&gt;추상클래스 사용 시기 : 상속 관계를 쭉 타고 올라갔을때 같은 조상클래스를 상속하는데 기능까지 완변히 똑같은 기능이 필요한 경우&lt;/p&gt;
&lt;p&gt;(ex. attack, printInfo)&lt;/p&gt;
&lt;p&gt;인터페이스 사용 시기 : 상속 관계를 쭉 타고 올라갔을때 다른 조상클래스를 상속하는데 같은 기능이 필요할 경우 인터페이스 사용&lt;/p&gt;
&lt;p&gt;(ex. Swimable)&lt;span class=&quot;bundle_ccl&quot;&gt;&lt;span class=&quot;ico_postbtn ico_ccl1&quot;&gt;&lt;/span&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;</description>
      <category>Java</category>
      <author>디케이형</author>
      <guid isPermaLink="true">https://d8040.tistory.com/201</guid>
      <comments>https://d8040.tistory.com/201#entry201comment</comments>
      <pubDate>Sat, 27 Feb 2021 11:54:56 +0900</pubDate>
    </item>
    <item>
      <title>[jQuery]  자바스크립트 form 태그 submit</title>
      <link>https://d8040.tistory.com/200</link>
      <description>&lt;p&gt;입력 양식은&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;전체 영역을 정의하기 위한 &amp;lt;form&amp;gt; 태그&lt;/b&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;안에&lt;/p&gt;
&lt;p&gt;&lt;b&gt;입력 항목의 그룹을 위한 &amp;lt;fieldset&amp;gt; 태그&lt;/b&gt;가 포함된 형태로 정의됩니다.&lt;/p&gt;
&lt;p&gt;또한 &amp;lt;fieldset&amp;gt; 태그 안에는&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;그룹의 제목 지정을 위해 &amp;lt;legend&amp;gt; 태그&lt;/b&gt;가 사용될 수 있습니다.&lt;/p&gt;
&lt;p&gt;기본적으로 &amp;lt;fieldset&amp;gt; 태그와 &amp;lt;legend&amp;gt; 태그는&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;생략이 가능&lt;/b&gt;합니다.&lt;/p&gt;
&lt;pre id=&quot;code_1614084678424&quot; class=&quot;javascript&quot; data-ke-language=&quot;javascript&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;lt;body&amp;gt;
      &amp;lt;!-- 입력 내용을 감싸기 위한 부분 --&amp;gt;
    &amp;lt;form&amp;gt;
      &amp;lt;!-- 입력 항목의 그룹 --&amp;gt;
        &amp;lt;fieldset&amp;gt;
              &amp;lt;!-- 그룹의 제목 --&amp;gt;
            &amp;lt;legend&amp;gt;제목입니다.&amp;lt;/legend&amp;gt;

        &amp;lt;/fieldset&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;데이터 전송(submit) 하기 (1)&lt;/h3&gt;
&lt;p&gt;버튼 표시하기&lt;/p&gt;
&lt;pre id=&quot;code_1614084584566&quot; class=&quot;html xml&quot; style=&quot;overflow: auto; margin: 0px; padding: 0px; word-break: break-all; white-space: pre-wrap; overflow-wrap: break-word; color: #000000; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;html&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;lt;input type=&quot;submit|button|reset|image&quot; value=&quot;버튼 표시 텍스트&quot; [src=&quot;이미지경로&quot;] /&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;hr style=&quot;display: block; border: none; font-size: 0px; line-height: 0; height: 20px; margin: 20px auto; background: url('https://t1.daumcdn.net/keditor/dist/0.4.0/image/divider-line.svg') 0px -120px / 200px 200px; cursor: pointer !important; color: #000000; font-family: 'Noto Sans KR', sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style5&quot; /&gt;
&lt;p&gt;input 태그의 type 속성은 submit, button, reset, image 중 하나를 선택하면 됩니다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;submit과 image 속성&lt;/b&gt;은&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;u&gt;둘 다&lt;/u&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;입력한 내용들을 웹프로그램에게 전송하는 기능&lt;/b&gt;을 합니다.&lt;/p&gt;
&lt;p&gt;image 속성의 경우 버튼에 이미지를 표시합니다. (value 속성 대신 src 속성이 사용됩니다.)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;* HTML5에서부터는 fromaction(action 주소)을 설정하는게 가능합니다.&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;button은 아무런 동작이 없으며 일반적으로 Javascript와 연결하여 특정 동작을 구현하기 위해 사용합니다!&lt;/p&gt;
&lt;p&gt;(데이터 전송을 바로 하지 않고, '&lt;b&gt;Javascript와 연결하여 특정 동작 후 전송을 하겠다'&lt;/b&gt;한다면 지정하면 됩니다.)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;reset은 사용자가 입력한 모든 내용을 삭제합니다.&lt;/p&gt;
&lt;hr style=&quot;display: block; border: none; font-size: 0px; line-height: 0; height: 20px; margin: 20px auto; background: url('https://t1.daumcdn.net/keditor/dist/0.4.0/image/divider-line.svg') 0px -120px / 200px 200px; cursor: pointer !important; color: #000000; font-family: 'Noto Sans KR', sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style5&quot; /&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;데이터 전송(submit) 하기 (2)&lt;/h3&gt;
&lt;pre id=&quot;code_1614084584567&quot; class=&quot;html xml&quot; style=&quot;overflow: auto; margin: 0px; padding: 0px; word-break: break-all; white-space: pre-wrap; overflow-wrap: break-word; color: #000000; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;html&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;lt;form method=&quot;post|get&quot; action=&quot;웹 프로그램 URL&quot; [enctype=&quot;multipart/form-data&quot;]&amp;gt;

	... 전송값 입력 내용들 ...
    
&amp;lt;/form&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;lt;form&amp;gt; 요소 내의 submit 버튼이 눌러지거나 Javascript와 연결되어있는 button을 통해서 submit이 수행된다면&lt;/p&gt;
&lt;p&gt;현재 &amp;lt;form&amp;gt; 안에 사용가가 입력한&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;모든&lt;/b&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;내용들이 action 속성에서 명시하는 웹 프로그램 페이지로 전송됩니다.&lt;/p&gt;
&lt;p&gt;enctype 속성은 입력 양식 안에&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;파일 첨부 기능이 포함되어 있는 경우&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;u&gt;반드시&lt;/u&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;지정&lt;/b&gt;해야 한다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;method 속성은 전송방식을 의미한다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;- get : 입력된 모든 내용이 URL에 포함되어 전송된다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;- post : 입력된 내용이 URL에 노출되지 않는다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;get과 post에 대한 내용은 다른 글들에서도 쉽게 찾을 수 있을 것입니다!&lt;/p&gt;
&lt;p&gt;시간이 된다면 정리를 해보겠지만 아니라면 다른 곳들을 통해 참조해주세요!&lt;/p&gt;
&lt;hr style=&quot;display: block; border: none; font-size: 0px; line-height: 0; height: 20px; margin: 20px auto; background: url('https://t1.daumcdn.net/keditor/dist/0.4.0/image/divider-line.svg') 0px -120px / 200px 200px; cursor: pointer !important; color: #000000; font-family: 'Noto Sans KR', sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style5&quot; /&gt;
&lt;p&gt;위에서는 &amp;lt;input&amp;gt; 태그의 type 속성으로 4가지를 소개했었지만,&lt;/p&gt;
&lt;p&gt;HTML5부터는 입력값의 형태에 따라 &amp;lt;input&amp;gt; 태그의 type 속성에 부여할 수 있는 종류가 추가되어 다양해졌습니다.&lt;/p&gt;
&lt;p&gt;type값에 따라 모바일 환경에서의 기본 키보드 형태가 변경됩니다!&lt;/p&gt;
&lt;p&gt;url : 웹 페이지의 URL을 입력할 수 있다.&lt;/p&gt;
&lt;p&gt;tel : 전화번호를 입력할 수 있다.&lt;/p&gt;
&lt;p&gt;number : 숫자값을 입력할 수 있다. min, max, step 속성을 추가적으로 사용하여 최소값, 최대값, 입력 단계들을 설정할 수 있습니다.&lt;/p&gt;
&lt;p&gt;range : 슬라이드 바 형태로 수치값을 선택할 수 있다.&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;min, max, step 속성을 추가적으로 사용하여 최소값, 최대값, 입력 단계들을 설정할 수 있습니다.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #333333;&quot;&gt;date : 날짜 형식의 값을 입력한다.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;time : 시간 형식의 값을 입력한다.&lt;/p&gt;
&lt;p&gt;email : 이메일을 입력할 수 있다.&lt;/p&gt;
&lt;p&gt;search : 검색어를 입력하는 용도로 사용한다.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;전화번호 뿐 아닌&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;숫자를 받는 경우&lt;/b&gt;(인증번호, 주민번호)를 위하여 type 속성의 값으로&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;u&gt;&lt;b&gt;tel&lt;/b&gt;&lt;/u&gt;을 주는 경우도 있습니다!&lt;/p&gt;
&lt;hr style=&quot;display: block; border: none; font-size: 0px; line-height: 0; height: 20px; margin: 20px auto; background: url('https://t1.daumcdn.net/keditor/dist/0.4.0/image/divider-line.svg') 0px -120px / 200px 200px; cursor: pointer !important; color: #000000; font-family: 'Noto Sans KR', sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style5&quot; /&gt;
&lt;h3 data-ke-size=&quot;size23&quot;&gt;&amp;lt;button&amp;gt; 태그 (HTML5)&lt;/h3&gt;
&lt;p&gt;&amp;lt;input type=&quot;submit|image|reset|button&quot;/&amp;gt;을 대체하기 위한 새로운 태그&lt;/p&gt;
&lt;p&gt;오직&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;form 태그에만 지정할 수 있던 method, action 속성을&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;u&gt;개별적으로!!! 지정&lt;/u&gt;&lt;/b&gt;할 수 있습니다.&lt;/p&gt;
&lt;p&gt;즉 기존에는 &amp;lt;form&amp;gt; 하나 당 (버튼의 수에 상관없이) 한개의 웹 프로그램만 연동 가능했지만, 이제는 개별 버튼별로 연동을 지정하여 하나의 폼 태그안에서 여러개의 Submit 전송이 가능하다는 이야기입니다.&lt;/p&gt;
&lt;p&gt;그렇다면 &amp;lt;button&amp;gt; 태그의 속성에 대해 알아보도록 하겠습니다.&lt;/p&gt;
&lt;pre id=&quot;code_1614084584568&quot; class=&quot;html xml&quot; style=&quot;overflow: auto; margin: 0px; padding: 0px; word-break: break-all; white-space: pre-wrap; overflow-wrap: break-word; color: #000000; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;html&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;lt;button type = &quot;submit|button|reset&quot;
	formaction = &quot;url&quot;
	formmethod = &quot;get|post&quot;
	formtarget = &quot;_blank|_self|_parent|_top&quot; /&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;type : 버튼의 종류를 지정한다.&lt;/p&gt;
&lt;p&gt;formaction : 데이터를 전송할 파일을 지정한다.&lt;/p&gt;
&lt;p&gt;formmethod : 전송 방식을 지정한다.&lt;/p&gt;
&lt;p&gt;formtarget : form의 target속성을 덮어쓴다.&lt;/p&gt;
&lt;hr style=&quot;display: block; border: none; font-size: 0px; line-height: 0; height: 20px; margin: 20px auto; background: url('https://t1.daumcdn.net/keditor/dist/0.4.0/image/divider-line.svg') 0px -120px / 200px 200px; cursor: pointer !important; color: #000000; font-family: 'Noto Sans KR', sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style5&quot; /&gt;
&lt;p&gt;그럼 button 태그를 배웠으니 본격적으로 한 form안의 데이터를 여러개의 url에 action을 전송하는 방법에 대해 알아보겠습니다.&lt;/p&gt;
&lt;p&gt;입력 양식 구성을 위한 form 영역 준비하기&lt;/p&gt;
&lt;pre id=&quot;code_1614084584568&quot; class=&quot;html xml&quot; style=&quot;overflow: auto; margin: 0px; padding: 0px; word-break: break-all; white-space: pre-wrap; overflow-wrap: break-word; color: #000000; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;html&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;lt;body&amp;gt;
	&amp;lt;form name=&quot;form1&quot;&amp;gt;
    	&amp;lt;h1&amp;gt;회원가입&amp;lt;/h1&amp;gt;
        	&amp;lt;fieldset&amp;gt;
        		&amp;lt;legend&amp;gt; 부가 정보 &amp;lt;/legned&amp;gt;
                
                  &amp;lt;div&amp;gt;
                      &amp;lt;label for=&quot;user_mail&quot;&amp;gt;이메일: &amp;lt;/label&amp;gt;
                      &amp;lt;input type=&quot;email&quot; name=&quot;user_mail&quot; id=&quot;user_mail&quot; required=&quot;required&quot; title=&quot;student@gmail.com&quot;/&amp;gt;
                  &amp;lt;/div&amp;gt;

                  &amp;lt;div&amp;gt;
                      &amp;lt;label for=&quot;user_homepage&quot;&amp;gt;홈페이지: &amp;lt;/label&amp;gt;
                      &amp;lt;input type=&quot;url&quot; name=&quot;user_homepage&quot; id=&quot;user_homepage&quot; /&amp;gt;
                  &amp;lt;/div&amp;gt;

                  &amp;lt;div&amp;gt;
                      &amp;lt;label for=&quot;user_age&quot;&amp;gt;나이: &amp;lt;/label&amp;gt;
                      &amp;lt;input type=&quot;number&quot; name=&quot;user_age&quot; id=&quot;user_age&quot; min=&quot;19&quot; max=&quot;100&quot; step=&quot;1&quot;/&amp;gt;
                  &amp;lt;/div&amp;gt;

                  &amp;lt;div&amp;gt;
                      &amp;lt;label for=&quot;user_phone&quot;&amp;gt;연락처: &amp;lt;/label&amp;gt;
                      &amp;lt;input type=&quot;tel&quot; name=&quot;user_phone&quot; id=&quot;user_phone&quot;/&amp;gt;
                  &amp;lt;/div&amp;gt;

                  &amp;lt;div&amp;gt;
                      &amp;lt;label for=&quot;point&quot;&amp;gt;목표성취도(%): &amp;lt;/label&amp;gt;
                      &amp;lt;input type=&quot;range&quot; name=&quot;point&quot; id=&quot;point&quot; value=&quot;50&quot; min=&quot;0&quot; max=&quot;100&quot; /&amp;gt;
                  &amp;lt;/div&amp;gt;

                  &amp;lt;div&amp;gt;
                      &amp;lt;label for=&quot;birthday&quot;&amp;gt;생년월일: &amp;lt;/label&amp;gt;
                      &amp;lt;input type=&quot;date&quot; name=&quot;birthday&quot; id=&quot;birthday&quot; value=&quot;2014-11-30&quot; /&amp;gt;
                  &amp;lt;/div&amp;gt;

                  &amp;lt;div&amp;gt;
                      &amp;lt;label for=&quot;worktime&quot;&amp;gt;출근시간: &amp;lt;/label&amp;gt;
                      &amp;lt;input type=&quot;time&quot; name=&quot;worktime&quot; id=&quot;worktime&quot; value=&quot;09:00&quot; /&amp;gt;
                  &amp;lt;/div&amp;gt;

                  &amp;lt;div&amp;gt;
                      &amp;lt;label for=&quot;friend&quot;&amp;gt;추천인 아이디: &amp;lt;/label&amp;gt;
                      &amp;lt;input type=&quot;search&quot; name=&quot;friend&quot; id=&quot;friend&quot; /&amp;gt;
                  &amp;lt;/div&amp;gt;

                  &amp;lt;div&amp;gt;
                      &amp;lt;button type=&quot;submit&quot; formaction=&quot;action1.html&quot;
                          formmethod=&quot;get&quot; formtarget=&quot;_blank&quot;&amp;gt;14세 이상 회원가입&amp;lt;/button&amp;gt;
                      &amp;lt;button type=&quot;submit&quot; formaction=&quot;action2.html&quot;
                          formmethod=&quot;post&quot; formtarget=&quot;_self&quot;&amp;gt;14세 미만 회원가입&amp;lt;/button&amp;gt;
                  &amp;lt;/div&amp;gt;                  
			&amp;lt;/fieldset&amp;gt;
	&amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;위 코드의 마지막 부분들을 보면 &amp;lt;button&amp;gt; 태그의 formaction 속성을 확인할 수 있습니다.&lt;/p&gt;
&lt;p&gt;button의 formaction 속성에 다른 url을 줌으로 인해서 다른 액션(action)을 취할 수 있게 합니다.&lt;/p&gt;
&lt;p&gt;또한 Javascript(jQuery)를 통해서 버튼이 눌렸을 때(onclick) form에 action속성을 정해주는 방법도 있습니다.&lt;/p&gt;
&lt;pre id=&quot;code_1614084584568&quot; class=&quot;html xml&quot; style=&quot;overflow: auto; margin: 0px; padding: 0px; word-break: break-all; white-space: pre-wrap; overflow-wrap: break-word; color: #000000; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;html&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;$(&quot;form&quot;).attr(&quot;action&quot;, &quot;action1.html&quot;);

$(&quot;form&quot;).action=&quot;action2.html&quot;;&lt;/code&gt;&lt;/pre&gt;
&lt;hr style=&quot;display: block; border: none; font-size: 0px; line-height: 0; height: 20px; margin: 20px auto; background: url('https://t1.daumcdn.net/keditor/dist/0.4.0/image/divider-line.svg') 0px -120px / 200px 200px; cursor: pointer !important; color: #000000; font-family: 'Noto Sans KR', sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style5&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;간단 정리 :&lt;/span&gt;&lt;/h2&gt;
&lt;p data-ke-size=&quot;size18&quot;&gt;&lt;b&gt;1. jQuery attr 또는 action으로 액션(action) url을 지정해주거나,&lt;/b&gt;&lt;/p&gt;
&lt;p data-ke-size=&quot;size18&quot;&gt;&lt;b&gt;2. input 또는 button의 formaction 속성을 통해 액션(action) url을 지정해주면 된다.&lt;/b&gt;&lt;/p&gt;</description>
      <category>HTML, CSS</category>
      <author>디케이형</author>
      <guid isPermaLink="true">https://d8040.tistory.com/200</guid>
      <comments>https://d8040.tistory.com/200#entry200comment</comments>
      <pubDate>Tue, 23 Feb 2021 21:52:12 +0900</pubDate>
    </item>
    <item>
      <title>[Javascript] 자바스크립트 (error) 오류 정리</title>
      <link>https://d8040.tistory.com/199</link>
      <description>&lt;h2&gt;JavaScript에서 발생하는 오류(Error)의 종류&lt;/h2&gt;
&lt;p&gt;일반적으로 프로그래밍 중 발생할 수 있는 오류는 3가지가 있습니다.&lt;/p&gt;
&lt;h3&gt;1. 구문 오류(Syntax Error)&lt;/h3&gt;
&lt;p&gt;JavaScript가 요구하는 규칙대로 프로그램을 작성하지 않을 경우 발생합니다. 예를 들면 다음과 같은 코드입니다.&lt;/p&gt;
&lt;p&gt;▼ 구문 오류 발생 예제&lt;/p&gt;
&lt;pre class=&quot;language-js javascript&quot;&gt;&lt;code&gt;console.log(&quot;안녕하세요&quot;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;consoe.log&lt;/code&gt; 호출 시 &lt;code&gt;)&lt;/code&gt;를 누락하였습니다. 따라서 코드를 실행해보면 &lt;code&gt;SyntaxError: missing ) after argument list&lt;/code&gt;라는 오류 문구를 출력합니다.&lt;/p&gt;
&lt;h3&gt;2. 실행시간 오류(Runtime Error, Exception)&lt;/h3&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;이런 종류의 오류는 프로그램을 실행할 때 발생합니다. 다시 말해 실행(평가)해보기 전까지는 그곳에 오류가 있는지 알 수 없다는 뜻입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;다음의 실행시간 오류를 포함한 코드를 보겠습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;▼ 실행시간 오류 발생 예제&lt;/p&gt;
&lt;pre class=&quot;language-js javascript&quot;&gt;&lt;code&gt;function sum(a, b) {};
add(2, 2);&lt;/code&gt;&lt;/pre&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;이 코드는 실행하면 &lt;code&gt;ReferenceError: add is not defined&lt;/code&gt;라는 오류 문구를 출력합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;정의하지 않은 &lt;code&gt;add&lt;/code&gt; 함수를 호출하는 오류가 포함되어 있습니다. 실제 코드에 함수 &lt;code&gt;add&lt;/code&gt;는 없고 &lt;code&gt;sum&lt;/code&gt;만 정의되어 있는 것이 눈에 보이지만 인터프리터(Interpreter)는 실행 명령을 받기 전까지는 작성자의 의도를 알 수 없습니다. 현재 이 코드가 아직 작성 중인 것일 수도 있으며, 혹은 다른 scope에 정의가 되어 있을 수도 있기 때문입니다. 구문 오류와 달리 JavaScript의 문법에는 오류가 없습니다.&lt;/p&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;3. 논리적인 오류&lt;/h3&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;앞서 살펴본 2종류의 오류는 사실 인터프리터에 의해 자동으로 검출이 되므로 수정이 용이합니다. 때문에 2가지 종류의 오류는 사실 신경 쓸 부분이 많지 않습니다. 단지 콘솔에 출력되는 오류 문구를 구글에 검색해본 후 처리해주면 됩니다.&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;반면 논리적인 오류는 여러분의 프로그래밍에 논리적인 실수가 있을 때 발생합니다. 대부분의 경우 프로그램은 이러한 종류의 오류가 외부로 드러나지 않고 정상적으로 동작하기 때문에 프로그램 내부에 오류의 여부를 확인하기 힘듭니다.&lt;/p&gt;
&lt;div class=&quot;google-auto-placed ap_container&quot; style=&quot;width: 100%; height: auto; clear: both; &quot;&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;따라서 대부분의 소프트웨어 시험(Software Testing)은 바로 이런 종류의 오류를 검출하고 수정하기 위해서 수행합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;예를 들어 다음과 같습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;▼ 논리적인 오류 예시&lt;/p&gt;
&lt;pre class=&quot;html xml&quot; data-ke-language=&quot;html&quot;&gt;&lt;code&gt;function add(a, b) {console.log(a*b)};
add(2, 2);&lt;/code&gt;&lt;/pre&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;위 소스코드를 실행해보면 프로그램이 정상 실행되어 결과도 &lt;code&gt;4&lt;/code&gt;로 올바르게 화면에 출력합니다. 하지만 사실은 프로그래머가 계산 시 &lt;code&gt;+&lt;/code&gt;가 아닌 &lt;code&gt;*&lt;/code&gt;연산자를 사용한 잘못 구현한 함수입니다. (함수의 이름이 잘못되었을 수도 있습니다.)&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;논리적인 오류는 프로그램이 오류를 발생시키지 않기 때문에 증상을 외부로 드러내야 합니다.&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;논리적인 오류를 검출하기 위해 JavaScript와 같은 프로그래밍 언어들은 오류(예외)를 강제로 발생시킬 수 있습니다. 증상이 보지 않으면 내부의 오류를 알 수 없기 때문입니다.&lt;/p&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;Throw&lt;/h2&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;예외를 발생시키기 위해 JavaScript에서는 &lt;code&gt;throw&lt;/code&gt; 문을 사용합니다. 용법은 다음과 같습니다.&lt;/p&gt;
&lt;pre class=&quot;language-js javascript&quot;&gt;&lt;code&gt;throw 표현식;&lt;/code&gt;&lt;/pre&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;표현식에는 어떠한 값도 들어갈 수 있습니다. 때문에 다음과 같이 사용할 수도 있습니다.&lt;/p&gt;
&lt;pre class=&quot;language-js javascript&quot;&gt;&lt;code&gt;throw &quot;에러@Add&quot;;  // 문자열
throw 42;         // 숫자&lt;/code&gt;&lt;/pre&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;하지만 일반적으로 &lt;code&gt;Error&lt;/code&gt;객체를 사용합니다.&lt;/p&gt;
&lt;pre class=&quot;language-js javascript&quot;&gt;&lt;code&gt;throw new Error(customError);&lt;/code&gt;&lt;/pre&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;▼ 에러 객체 예외 발생 예제&lt;/p&gt;
&lt;pre class=&quot;language-js javascript&quot;&gt;&lt;code&gt;function add(a,b) { return a*b; }

function addTest() {
    let ret = add(2,3);
    let exp = 5;
    if (ret != exp) {
        throw new Error('Error @ addFunction');
    }
}

addTest();&lt;/code&gt;&lt;/pre&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;▼ 에러객체 예외 발생 예제 실행결과&lt;/p&gt;
&lt;pre class=&quot;language-js javascript&quot;&gt;&lt;code&gt;Uncaught Error: Error @ addFunction&lt;/code&gt;&lt;/pre&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;Try, Catch, Finally&lt;/h2&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;우리가 &lt;code&gt;throw&lt;/code&gt;를 사용해 의도적으로 발생시킨 오류를 포함해 앞서 오류의 예로 들었던 코드에서 발생시키는 예외들의 문구를 보면 다음과 같이 &lt;code&gt;Uncaught&lt;/code&gt;라는 문구가 붙어 있습니다. 그리고 공통적으로 프로그램의 구동이 그곳에서 중단되었습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;▼ 구문 오류 발생 예제 실행결과&lt;/p&gt;
&lt;pre class=&quot;language-js javascript&quot;&gt;&lt;code&gt;Uncaught SyntaxError: missing ) after argument list&lt;/code&gt;&lt;/pre&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;이것은 발생한 예외(오류)를 받아(catch) 처리할 수 있는 핸들러가 존재하지 않기 때문에 기본적으로 존재하는 예외처리 핸들러가 화면에 문구를 출력 후 프로그램을 종료시켰기 때문입니다. 반면에 이를 적절히 처리할 수 있는 핸들러가 있다면 프로그램은 오류가 아닌 정상 종료 또는 계속 실행될 것입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;JavaScript에서 제공하는 예외(오류)를 처리하는 방법은 &lt;i&gt;Try&lt;/i&gt;, &lt;i&gt;Catch&lt;/i&gt; 그리고 &lt;i&gt;Finally&lt;/i&gt; 를 사용하는 것입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;우선 &lt;i&gt;try&lt;/i&gt; 절 내부에 에러를 발생시킬 가능성이 있는 코드를 내부에 삽입합니다. 그 뒤로 오류를 처리할 수 있는 1개 이상의 &lt;i&gt;catch&lt;/i&gt; 절이 뒤따르고 옵션으로 &lt;i&gt;finally&lt;/i&gt; 절이 나올 수도 있습니다. 다음과 같이 3가지 형태를 띠게 됩니다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;i&gt;try-catch&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;try-finally&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;try-catch-finally&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;다음과 같이 사용할 수 있습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;▼ try - catch 예제&lt;/p&gt;
&lt;pre class=&quot;language-js javascript&quot;&gt;&lt;code&gt;function add(a,b) { return a*b; };

function addTest() {
    let ret = add(2,3);
    let exp = 5;
    if (ret != exp) {
        throw new Error('Error @ addFunction');
    }
};

try {
    addTest();
} catch (e) {
    console.log(e.name);
    console.log(e.message);
};&lt;/code&gt;&lt;/pre&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;앞서 기술했던 것과 같이 &lt;i&gt;try&lt;/i&gt; 절 내부에 실행할 코드를 넣고, 해당 코드의 실행 결과 오류가 발생하였을 때 이를 받아 처리할 수 있는 코드를 &lt;i&gt;catch&lt;/i&gt; 절 내부에 넣습니다. 예제에서는 발생한 error를 화면에 출력하였습니다.&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;▼ try - catch 예제 실행결과&lt;/p&gt;
&lt;pre class=&quot;language-js javascript&quot;&gt;&lt;code&gt;Error
Error @ addFunction&lt;/code&gt;&lt;/pre&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;사실, 실행 결과를 보면 화면에 출력되는 문구도 동일하며 앞선 결과와 크게 다르지 않습니다. 다른 점은 프로그램이 &lt;b&gt;정상 종료&lt;/b&gt;되었다는 것입니다. 즉, 앞서 발생한 오류는 _catch_를 통해서 마무리(개발자에게 상황을 알려주고)가 되었고 나머지 코드는 정상 실행되는 것입니다. 때문에 만약 JavaScript 에 추가 더 실행할 코드가 있었다면 그대로 실행이 되었을 것입니다.&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;마지막으로 &lt;i&gt;finally&lt;/i&gt; 절의 경우는 오류의 처리 여부와 관계없이 반드시 실행되는 코드를 넣습니다. 때문에 설령 미처리된 오류로 인하여 프로그램이 종료되는 경우도 &lt;i&gt;finally&lt;/i&gt; 내부의 코드를 실행한 후 종료가 됩니다.&lt;/p&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;결론&lt;/h2&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;우리들은 코드를 작성할 때 예외(오류)가 발생할 것을 기대하지는 않습니다. 때문에 &lt;i&gt;try&lt;/i&gt; 구문에서 실행되는 코드가 예외를 발생시키지 않는 것이 제일 좋은 상황이겠지만 그것이 불가능한 경우도 있습니다. 때문에 &lt;i&gt;try&lt;/i&gt; &amp;hellip; &lt;i&gt;catch&lt;/i&gt; 구문을 통하여 개발자에게 알려주어 이를 해결하거나, 예상되거나 해결이 가능한 오류인 경우, 자체적으로 적절히 처리하여 프로그램의 실행에 지장이 없도록 하는 것이 차선책이 될 것입니다.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>HTML, CSS</category>
      <author>디케이형</author>
      <guid isPermaLink="true">https://d8040.tistory.com/199</guid>
      <comments>https://d8040.tistory.com/199#entry199comment</comments>
      <pubDate>Tue, 23 Feb 2021 21:46:41 +0900</pubDate>
    </item>
    <item>
      <title>[jQuery] html 요소 삽입 추가하기 - before, after, prepend, append</title>
      <link>https://d8040.tistory.com/198</link>
      <description>&lt;h2 style=&quot;padding: 25px; background-color: #9fd7bf;&quot; data-ke-size=&quot;size26&quot;&gt;html 요소 삽입하기&lt;/h2&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;jQuery를 이용해 요소를 삽입하는 메소드는 &lt;span style=&quot;color: #ef5369;&quot;&gt;&lt;b&gt;before, after, prepend, append&lt;/b&gt;&lt;/span&gt; 등이 있다.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;각각의 메소드마다 요소가 삽입되는 위치가 조금씩 다르니 자신이 원하는 위치에 따라 알맞게 사용해야 한다.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size18&quot;&gt;&lt;b&gt;&amp;lt;before()을 이용해 요소 삽입하기&amp;gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #000000; background-color: #f6e199;&quot;&gt;&lt;b&gt;$(&lt;i&gt;selector&lt;/i&gt;).before(&lt;i&gt;content&lt;/i&gt;)&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #666666;&quot;&gt;// 이때 content에 들어갈 수 있는 값은 HTML elements, jQuery objects, DOM elements이다.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #000000;&quot;&gt;.before()는 &lt;i&gt;selector&lt;/i&gt; 이전에 &lt;i&gt;content&lt;/i&gt;를 삽입하는 메소드이다.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #000000; background-color: #f6e199;&quot;&gt;&lt;b&gt;$(&quot;h1&quot;).before(&quot;&amp;lt;div&amp;gt;Hello&amp;lt;/div&amp;gt;&quot;);&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #666666;&quot;&gt;// &amp;lt;h1&amp;gt;&amp;lt;/h1&amp;gt; 이전에 &amp;lt;div&amp;gt;Hello&amp;lt;/div&amp;gt; 삽입&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size18&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;lt;after()를 이용해 요소 삽입하기&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;background-color: #f6e199;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;$(&lt;/span&gt;&lt;i&gt;selector&lt;/i&gt;&lt;span style=&quot;color: #000000;&quot;&gt;).after(&lt;/span&gt;&lt;i&gt;content&lt;/i&gt;&lt;span style=&quot;color: #000000;&quot;&gt;)&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;.after()는 &lt;i&gt;selector&lt;/i&gt;&amp;nbsp;이후에 &lt;i&gt;content&lt;/i&gt;를 삽입하는 메소드이다.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;background-color: #f6e199;&quot;&gt;&lt;b&gt;$(&quot;h1&quot;).after(&quot;&amp;lt;div&amp;gt;Hello&amp;lt;/div&amp;gt;&quot;);&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #666666;&quot;&gt;// &amp;lt;h1&amp;gt;&amp;lt;/h1&amp;gt; 이후에&amp;nbsp;&amp;lt;div&amp;gt;Hello&amp;lt;/div&amp;gt; 삽입&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size18&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;lt;prepend()를 이용해 요소 삽입하기&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;background-color: #f6e199;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;$(&lt;/span&gt;&lt;i&gt;selector&lt;/i&gt;&lt;span style=&quot;color: #000000;&quot;&gt;).prepend(&lt;/span&gt;&lt;i&gt;content&lt;/i&gt;&lt;span style=&quot;color: #000000;&quot;&gt;)&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;.prepend()는&amp;nbsp;&lt;i&gt;selector&lt;/i&gt;의 맨 앞 자식 요소로&lt;i&gt;content&lt;/i&gt;를 삽입하는 메소드이다.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;background-color: #f6e199;&quot;&gt;&lt;b&gt;$(&quot;h1&quot;).prepend(&quot;&amp;lt;div&amp;gt;Hello&amp;lt;/div&amp;gt;&quot;);&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #666666;&quot;&gt;// h1의 열리는 태그 바로 뒤에 &amp;lt;div&amp;gt;Hello&amp;lt;/div&amp;gt; 삽입&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size18&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;lt;append()를 이용해 요소 삽입하기&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;background-color: #f6e199;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #000000;&quot;&gt;$(&lt;/span&gt;&lt;i&gt;selector&lt;/i&gt;&lt;span style=&quot;color: #000000;&quot;&gt;).append(&lt;/span&gt;&lt;i&gt;content&lt;/i&gt;&lt;span style=&quot;color: #000000;&quot;&gt;)&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;.append()는&amp;nbsp;&lt;i&gt;selector&lt;/i&gt;의 맨 뒤 자식 요소로&lt;i&gt;content&lt;/i&gt;를 삽입하는 메소드이다.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;background-color: #f6e199;&quot;&gt;&lt;b&gt;$(&quot;h1&quot;).append(&quot;&amp;lt;div&amp;gt;Hello&amp;lt;/div&amp;gt;&quot;);&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #666666;&quot;&gt;// h1의 닫히는 태그 바로 앞에 &amp;lt;div&amp;gt;Hello&amp;lt;/div&amp;gt; 삽입&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2 style=&quot;padding: 25px; background-color: #9fd7bf;&quot;&gt;before(), after(), prepend(), append() 사용 예시&lt;/h2&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size18&quot;&gt;&lt;b&gt;예시1) div 요소 추가하기&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;800&quot; data-origin-width=&quot;0&quot; data-origin-height=&quot;0&quot; data-ke-mobilestyle=&quot;widthContent&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/mIRFP/btqETKSIxu2/k3pZiyAa3tiYGaKWJzXV11/img.png&quot; data-lightbox=&quot;lightbox&quot; data-alt=&quot;html 코드&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/mIRFP/btqETKSIxu2/k3pZiyAa3tiYGaKWJzXV11/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FmIRFP%2FbtqETKSIxu2%2Fk3pZiyAa3tiYGaKWJzXV11%2Fimg.png&quot; width=&quot;800&quot; data-origin-width=&quot;0&quot; data-origin-height=&quot;0&quot; data-ke-mobilestyle=&quot;widthContent&quot;&gt;&lt;/span&gt;&lt;figcaption&gt;html 코드&lt;/figcaption&gt;&lt;/figure&gt;&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;800&quot; data-origin-width=&quot;0&quot; data-origin-height=&quot;0&quot; data-ke-mobilestyle=&quot;widthContent&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bC3cpX/btqEVYPmMPY/VZvWZVhIHXU5lkuXdUDNR0/img.png&quot; data-lightbox=&quot;lightbox&quot; data-alt=&quot;div 요소 추가 전 실행화면&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bC3cpX/btqEVYPmMPY/VZvWZVhIHXU5lkuXdUDNR0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbC3cpX%2FbtqEVYPmMPY%2FVZvWZVhIHXU5lkuXdUDNR0%2Fimg.png&quot; width=&quot;800&quot; data-origin-width=&quot;0&quot; data-origin-height=&quot;0&quot; data-ke-mobilestyle=&quot;widthContent&quot;&gt;&lt;/span&gt;&lt;figcaption&gt;div 요소 추가 전 실행화면&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; width=&quot;800&quot; data-origin-width=&quot;0&quot; data-origin-height=&quot;0&quot; data-ke-mobilestyle=&quot;widthContent&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bIrgL7/btqEUqF3jzI/mYq8B6RTtkxlQGkw9nsVd0/img.png&quot; data-lightbox=&quot;lightbox&quot; data-alt=&quot;div 요소 추가하는 js 코드&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bIrgL7/btqEUqF3jzI/mYq8B6RTtkxlQGkw9nsVd0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbIrgL7%2FbtqEUqF3jzI%2FmYq8B6RTtkxlQGkw9nsVd0%2Fimg.png&quot; width=&quot;800&quot; data-origin-width=&quot;0&quot; data-origin-height=&quot;0&quot; data-ke-mobilestyle=&quot;widthContent&quot;&gt;&lt;/span&gt;&lt;figcaption&gt;div 요소 추가하는 js 코드&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; data-origin-width=&quot;0&quot; data-origin-height=&quot;0&quot; width=&quot;800&quot; data-ke-mobilestyle=&quot;widthContent&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/OS56g/btqET7zVwHU/RJo7Fl2YH69MdZKTTk3sLk/img.png&quot; data-lightbox=&quot;lightbox&quot; data-alt=&quot;js코드가 적용된 실행화면&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/OS56g/btqET7zVwHU/RJo7Fl2YH69MdZKTTk3sLk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FOS56g%2FbtqET7zVwHU%2FRJo7Fl2YH69MdZKTTk3sLk%2Fimg.png&quot; data-origin-width=&quot;0&quot; data-origin-height=&quot;0&quot; width=&quot;800&quot; data-ke-mobilestyle=&quot;widthContent&quot;&gt;&lt;/span&gt;&lt;figcaption&gt;js코드가 적용된 실행화면&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;before와 after와는 다르게 &lt;span style=&quot;color: #ee2323;&quot;&gt;&lt;b&gt;prepend와 append는 h1요소 내에 포함&lt;/b&gt;&lt;/span&gt;된 것을 확인할 수 있다.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style=&quot;text-align: right;&quot; data-ke-size=&quot;size14&quot;&gt;&lt;span&gt;공부한 것을 정리한 내용입니다. 수정할 부분이 있다면 알려주시면 감사하겠습니다 :)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>HTML, CSS</category>
      <author>디케이형</author>
      <guid isPermaLink="true">https://d8040.tistory.com/198</guid>
      <comments>https://d8040.tistory.com/198#entry198comment</comments>
      <pubDate>Tue, 23 Feb 2021 21:36:23 +0900</pubDate>
    </item>
    <item>
      <title>[jQuery] 메소드 -.is(), .prop(), .html(), .text(), .attr()</title>
      <link>https://d8040.tistory.com/197</link>
      <description>&lt;blockquote data-ke-style=&quot;normal&quot;&gt;&lt;span&gt;&lt;b&gt;.is(:&lt;span&gt;속성&lt;/span&gt;) /&amp;nbsp;&lt;b&gt;.prop(&lt;span&gt;속성&lt;/span&gt;)&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;span&gt;&lt;b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&amp;nbsp;$(&quot;&lt;/span&gt;&lt;span&gt;선택자&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&quot;).is(:&lt;span&gt;속성&lt;/span&gt;&lt;/span&gt;)&amp;nbsp; /&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&amp;nbsp;$(&quot;&lt;/span&gt;&lt;span&gt;선택자&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&quot;).property(&lt;span&gt;속성&lt;/span&gt;&lt;/span&gt;)&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;선택자가 속성을 가지는지 아닌지 확인하여 true, false 값을 내놓음&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock floatLeft&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Ftvdd9%2FbtqxyhD1jsU%2FjQGB5bHoVkynOtIHX79Js0%2Fimg.png&quot; data-origin-width=&quot;648&quot; data-origin-height=&quot;630&quot; data-ke-mobilestyle=&quot;widthContent&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cHgI4I/btqYeaYVmLb/VkqJl7i9TqffKvKiywUsf0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cHgI4I/btqYeaYVmLb/VkqJl7i9TqffKvKiywUsf0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cHgI4I/btqYeaYVmLb/VkqJl7i9TqffKvKiywUsf0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Ftvdd9%2FbtqxyhD1jsU%2FjQGB5bHoVkynOtIHX79Js0%2Fimg.png&quot; data-origin-width=&quot;648&quot; data-origin-height=&quot;630&quot; data-ke-mobilestyle=&quot;widthContent&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;figure class=&quot;imageblock floatRight&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FrY1Zk%2FbtqxDVFy9Vc%2FRm3nsvSbygXxg0tjY6kOn0%2Fimg.png&quot; data-origin-width=&quot;269&quot; data-origin-height=&quot;520&quot; data-ke-mobilestyle=&quot;widthContent&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/cmSPqI/btqX82fXaoa/6FG6QVVv5CFmOsGG1hhlu1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/cmSPqI/btqX82fXaoa/6FG6QVVv5CFmOsGG1hhlu1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/cmSPqI/btqX82fXaoa/6FG6QVVv5CFmOsGG1hhlu1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FrY1Zk%2FbtqxDVFy9Vc%2FRm3nsvSbygXxg0tjY6kOn0%2Fimg.png&quot; data-origin-width=&quot;269&quot; data-origin-height=&quot;520&quot; data-ke-mobilestyle=&quot;widthContent&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;is()&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbXjeNZ%2FbtqxCPe1hTB%2F4EwD6px2THQMYN4gaK49jk%2Fimg.png&quot; data-origin-width=&quot;529&quot; data-origin-height=&quot;628&quot; data-ke-mobilestyle=&quot;widthContent&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/b5D13K/btqYebKhR3Y/KUeoyBZpb1eEDSavIS5aDk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/b5D13K/btqYebKhR3Y/KUeoyBZpb1eEDSavIS5aDk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/b5D13K/btqYebKhR3Y/KUeoyBZpb1eEDSavIS5aDk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbXjeNZ%2FbtqxCPe1hTB%2F4EwD6px2THQMYN4gaK49jk%2Fimg.png&quot; data-origin-width=&quot;529&quot; data-origin-height=&quot;628&quot; data-ke-mobilestyle=&quot;widthContent&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fv3fC5%2FbtqxCN9i6Od%2FCrbu6tYjTYLl2mTBY7tMR0%2Fimg.png&quot; data-origin-width=&quot;319&quot; data-origin-height=&quot;477&quot; data-ke-mobilestyle=&quot;widthContent&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bh3EHE/btqYbI2FzEu/VZhvr4NJkTUwFK3mGC0htk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bh3EHE/btqYbI2FzEu/VZhvr4NJkTUwFK3mGC0htk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bh3EHE/btqYbI2FzEu/VZhvr4NJkTUwFK3mGC0htk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fv3fC5%2FbtqxCN9i6Od%2FCrbu6tYjTYLl2mTBY7tMR0%2Fimg.png&quot; data-origin-width=&quot;319&quot; data-origin-height=&quot;477&quot; data-ke-mobilestyle=&quot;widthContent&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;prop()&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;blockquote data-ke-style=&quot;normal&quot;&gt;&lt;span&gt;&lt;b&gt;.html()&lt;/b&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;span&gt;&lt;b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&amp;nbsp;$(&quot;&lt;/span&gt;&lt;span&gt;선택자&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&quot;).html(&lt;/span&gt;)&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;선택자의&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;u&gt;코드 및 내용&lt;/u&gt;을 표기, 혹은 선택자 안의 내용을 html 괄호 안의 내용으로 교체&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcLDHnv%2FbtqxBQSY7A4%2FLRKK7Y2ONc0Rngbvc4eHiK%2Fimg.png&quot; data-origin-width=&quot;538&quot; data-origin-height=&quot;417&quot; data-ke-mobilestyle=&quot;widthContent&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bz3VTm/btqYbI9lLde/lKb8CXGqwLIf1OIh8z6KK1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bz3VTm/btqYbI9lLde/lKb8CXGqwLIf1OIh8z6KK1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bz3VTm/btqYbI9lLde/lKb8CXGqwLIf1OIh8z6KK1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcLDHnv%2FbtqxBQSY7A4%2FLRKK7Y2ONc0Rngbvc4eHiK%2Fimg.png&quot; data-origin-width=&quot;538&quot; data-origin-height=&quot;417&quot; data-ke-mobilestyle=&quot;widthContent&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbNKJae%2FbtqxyM4BOSa%2FvrDVr4uVhHpQ6WbeYKzQWK%2Fimg.png&quot; data-origin-width=&quot;708&quot; data-origin-height=&quot;590&quot; data-ke-mobilestyle=&quot;widthContent&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/JJuIj/btqX6fs7p91/gfbBffVkBOCKspGiY27ftk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/JJuIj/btqX6fs7p91/gfbBffVkBOCKspGiY27ftk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/JJuIj/btqX6fs7p91/gfbBffVkBOCKspGiY27ftk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbNKJae%2FbtqxyM4BOSa%2FvrDVr4uVhHpQ6WbeYKzQWK%2Fimg.png&quot; data-origin-width=&quot;708&quot; data-origin-height=&quot;590&quot; data-ke-mobilestyle=&quot;widthContent&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;blockquote data-ke-style=&quot;normal&quot;&gt;&lt;span&gt;&lt;b&gt;&lt;b&gt;.text()&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;span&gt;&lt;b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&amp;nbsp;$(&quot;&lt;/span&gt;&lt;span&gt;선택자&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&quot;).text(&lt;/span&gt;)&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;선택자가 가진&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;u&gt;내용만&lt;/u&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;표기, 혹은 선택자 안의 내용을 text괄호 안의 내용으로 교체&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;b&gt;&lt;b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FGFVE4%2FbtqxyM4BZRa%2FFsFi1HtiMsHsNfjyvJ9Ho0%2Fimg.png&quot; data-origin-width=&quot;445&quot; data-origin-height=&quot;321&quot; data-ke-mobilestyle=&quot;widthContent&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bCpxyO/btqX32guNKp/3B3AXJY49wHoVxxmd2ln60/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bCpxyO/btqX32guNKp/3B3AXJY49wHoVxxmd2ln60/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bCpxyO/btqX32guNKp/3B3AXJY49wHoVxxmd2ln60/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FGFVE4%2FbtqxyM4BZRa%2FFsFi1HtiMsHsNfjyvJ9Ho0%2Fimg.png&quot; data-origin-width=&quot;445&quot; data-origin-height=&quot;321&quot; data-ke-mobilestyle=&quot;widthContent&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbT8wcV%2Fbtqxyvow1kl%2FXxF8HmAwWzQrNHEVJnk00K%2Fimg.png&quot; data-origin-width=&quot;701&quot; data-origin-height=&quot;482&quot; data-ke-mobilestyle=&quot;widthContent&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/sjUA2/btqYfV8aLdO/Mpye5PCvSgidluhwT1DWgK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/sjUA2/btqYfV8aLdO/Mpye5PCvSgidluhwT1DWgK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/sjUA2/btqYfV8aLdO/Mpye5PCvSgidluhwT1DWgK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbT8wcV%2Fbtqxyvow1kl%2FXxF8HmAwWzQrNHEVJnk00K%2Fimg.png&quot; data-origin-width=&quot;701&quot; data-origin-height=&quot;482&quot; data-ke-mobilestyle=&quot;widthContent&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;blockquote data-ke-style=&quot;normal&quot;&gt;&lt;span&gt;&lt;b&gt;&lt;b&gt;.attr(속성) / .attr({속성변동})&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;span&gt;&lt;b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&amp;nbsp;$(&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;요소&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&quot;).attr(&lt;span&gt;속성&lt;/span&gt;&lt;/span&gt;)&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;속성을 가진 요소 선택&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;&lt;span&gt;&lt;b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&amp;nbsp;$(&quot;&lt;/span&gt;&lt;span&gt;선택자&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&quot;).attr({&lt;span&gt;속성변동 함수&lt;/span&gt;}&lt;/span&gt;)&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;선택자의 속성을 함수값 등에 맞게 변동&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F11RMA%2FbtqxB7tvaQ0%2FVU1WHv9s6rkMr8Bvkd7Fok%2Fimg.png&quot; data-origin-width=&quot;514&quot; data-origin-height=&quot;417&quot; data-ke-mobilestyle=&quot;widthContent&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bAavLp/btqYiC07lPH/ff6jekYExZKzHskzcKgpH1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bAavLp/btqYiC07lPH/ff6jekYExZKzHskzcKgpH1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bAavLp/btqYiC07lPH/ff6jekYExZKzHskzcKgpH1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F11RMA%2FbtqxB7tvaQ0%2FVU1WHv9s6rkMr8Bvkd7Fok%2Fimg.png&quot; data-origin-width=&quot;514&quot; data-origin-height=&quot;417&quot; data-ke-mobilestyle=&quot;widthContent&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;figure class=&quot;imageblock alignCenter&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F6Mbu3%2FbtqxBQrU5PH%2FZhWl70t7pY1CZoq4gN4a60%2Fimg.png&quot; data-origin-width=&quot;374&quot; data-origin-height=&quot;500&quot; data-ke-mobilestyle=&quot;widthContent&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/dBxHn3/btqX821lCSb/zQeuGtCDjLlTefwM4pYPZK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/dBxHn3/btqX821lCSb/zQeuGtCDjLlTefwM4pYPZK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/dBxHn3/btqX821lCSb/zQeuGtCDjLlTefwM4pYPZK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F6Mbu3%2FbtqxBQrU5PH%2FZhWl70t7pY1CZoq4gN4a60%2Fimg.png&quot; data-origin-width=&quot;374&quot; data-origin-height=&quot;500&quot; data-ke-mobilestyle=&quot;widthContent&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;출처:&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;https://kingji8life.tistory.com/164&quot;&gt;https://kingji8life.tistory.com/164&lt;/a&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;[KingJI Life]&lt;/span&gt;&lt;/p&gt;</description>
      <category>HTML, CSS</category>
      <author>디케이형</author>
      <guid isPermaLink="true">https://d8040.tistory.com/197</guid>
      <comments>https://d8040.tistory.com/197#entry197comment</comments>
      <pubDate>Tue, 23 Feb 2021 00:05:46 +0900</pubDate>
    </item>
  </channel>
</rss>