선형대수학 Linear Algebra

Size: px
Start display at page:

Download "선형대수학 Linear Algebra"

Transcription

1 배열, 컬렉션, 인덱서 array, collection, indexer 소프트웨어학과 HCI 프로그래밍강좌

2 배열 배열 (array) 동일한자료형을다수선언 선언형식 데이터형식 [ ] 배열이름 = new 데이터형식 [ 개수 ]; int[ ] array = new int[5]; 인덱스 (index) 는 0 에서시작 scores[0] = 80; scores[1] = 74; scores[2] = 81; scores[3] = 90; scores[4] = 34 [0] [1] [2] [3] [4] for (int k=0; k < 5; k++) Console.WriteLine( scores[k] ); foreach (int score in scores) Console.WriteLine( score );

3 배열 초기화방법 string[ ] array1 = new string[3] " 안녕 ", "Hello", "Halo" ; string[ ] array2 = new string[ ] " 안녕 ", "Hello", "Halo" ; string[ ] array3 = " 안녕 ", "Hello", "Halo" ; 선언후메모리할당 string[ ] array4; // 참조변수 array4 = new string[3];

4 배열 참조배열 값타입 (value type) 배열의메모리생성 배열생성과동시에메모리확보 int[ ] array = new int[5]; 참조타입 (reference type) 배열의메모리생성 각원소의참조값을저장하는공간만확보 실제원소의객체를저장하기위한공간별도생성필요 Animal[ ] stock = new Animal[3]; stock[0] = new Animal( goat ); stock[1] = new Animal( cow ); stock[2] = new Animal( pig ); stock stock[0] stock[1] stock[2] goat cow pig

5 배열 class Animal private string species; public Animal(string name) this.species = name; public override string ToString() return species; class MainApp static void Main(string[] args) Animal[] stock = new Animal[3]; stock[0] = new Animal("goat"); stock[1] = new Animal("cow"); stock[2] = new Animal("pig"); Stock : goat = HashCode : Stock : cow = HashCode : Stock : pig = HashCode : 해시코드 (hashcode) : 객체의메모리가생성될때객체에부여되는 32 비트정수값 foreach (Animal name in stock) Console.WriteLine("Stock : 0 = HashCode : 1", name, name.gethashcode());

6 System.Array 클래스 System.Array 클래스 모든배열이상속받는클래스 분류 이름 설명 Sort() 배열정렬 BinarySearch<T>( ) 이진탐색수행 IndexOf( ) 배열에서찾고자하는특정데이터의인덱스반환 TrueForAll<T>( ) 배열의모든요소가지정한조건에부합하는지의여부반환 정적메소드 FindIndex<T>( ) Resize<T>( ) Clear( ) ForEach<T>( ) 배열에서지정한조건에부합하는첫번째요소의인덱스반환. IndexOf( ) : 특정값을갖는것의인덱스반환. FindIndex<T>( ) : 지정한조건의값을찾아인덱스반환. 배열의크기재조정 배열의모든요소초기화 배열의모든요소에대해동일한작업수행 인스턴스메소드 프로퍼티 Length Rank GetLength( ) 배열에서지정한차원의길이반환. 다차원배열에서유용 배열의길이반환 배열의차원반환

7 정적메소드 / 인스턴스메소드 정적메소드 (static method) 클래스의인스턴스를생성하지않아도호출할수있는메소드 static 키워드사용선언 class StClass public static void StaticMethod( ) // StClass.StaticMethod( ); 인스턴스메소드 (instance method) 클래스의인스턴스를생성해야만호출할수있는메소드 class InsClass public void InstanceMethod( ) // InsClass myobj = new InsClass(); MyObj.InstanceMethod( );

8 형식매개변수 / 델리게이트 형식매개변수 (type parameter) 메소드를호출할때 T 대신에기반자료형을변수처럼전달 BinarySearch<T>( ) Array.BinarySearch<int>(scores, 81); 델리게이트 (deligate, 대리인 ) 메소드를참조하는것 delegate int MyDeligate (int a, int b); public int Plus(int x, int y) return x+y; // MyDeligate Ops = new MyDeligate(Plus); ConsoleWrite(Ops(5,10)); Action 델리게이트 이름이없는델리게이트선언에사용 new Action<int>(Print);

9 class MainApp private static bool CheckPassed(int score) if ( score >= 60 ) return true; else return false; private static void Print(int value) Console.Write("0 ", value); int index = Array.FindIndex<int>(scores, delegate(int score ) if (score < 60) return true; else return false; ); scores[index] = 61; Console.WriteLine("Everyone passed? : 0", Array.TrueForAll<int>(scores, CheckPassed)); static void Main(string[ ] args) int[ ] scores = new int[ ]80, 74, 81, 90, 34; Console.WriteLine("Old length of scores : 0", scores.getlength(0)); Array.Resize<int>(ref scores, 10); foreach (int score in scores) Console.Write("0 ", score); Console.WriteLine("New length of scores : 0", scores.length); Array.ForEach<int>(scores, new Action<int>(Print)); Array.Sort(scores); Array.ForEach<int>(scores, new Action<int>(Print)); Console.WriteLine("Number of dimensions : 0", scores.rank); Console.WriteLine("Binary Search : 81 is at 0", Array.BinarySearch<int>(scores, 81)); Console.WriteLine("Linear Search : 90 is at 0", Array.IndexOf(scores, 90)); Console.WriteLine("Everyone passed? : 0", Array.TrueForAll<int>(scores, CheckPassed)); Array.Clear(scores, 3, 7); Array.ForEach<int>(scores, new Action<int>(Print)); Number of dimensions : 1 Binary Search : 81 is at 3 Linear Search : 90 is at 4 Everyone passed? : False Everyone passed? : True Old length of scores : 5 New length of scores :

10 2 차원배열 2 차원배열 선언방법 데이터형식 [,] 배열이름 = new 데이터형식 [ 행의크기, 열의크기 ]; int[, ] array = new int[ 2, 3 ]; 배열사용 array[ 0, 0 ] = 1; array[ 0, 1 ] = 2; array[ 0, 2 ] = 3; array[ 1, 0 ] = 4; array[ 1, 2 ] = 5; array[ 1, 3 ] = 6; 배열의초기화 int[,] arr1 = new int[2, 3] 1, 2, 3, 4, 5, 6; int[,] arr2 = new int[,] 1, 2, 3, 4, 5, 6; int[,] arr3 = 1, 2, 3, 4, 5, 6;

11 class MainApp static void Main(string[] args) int[,] arr = new int[2, 3] 1, 2, 3, 4, 5, 6 ; GetLength(int dim) 메소드 지정된차원의크기반환 dim == 0 일때, 첫번째차원의크기반환 for (int i = 0; i < arr.getlength(0); i++) for (int j = 0; j < arr.getlength(1); j++) Console.Write("[0, 1] : 2 ", i, j, arr[i, j]); int[,] arr2 = new int[,] 1, 2, 3, 4, 5, 6 ; for (int i = 0; i < arr2.getlength(0); i++) for (int j = 0; j < arr2.getlength(1); j++) Console.Write("[0, 1] : 2 ", i, j, arr2[i, j]); int[,] arr3 = 1, 2, 3, 4, 5, 6 ; for (int i = 0; i < arr2.getlength(0); i++) for (int j = 0; j < arr2.getlength(1); j++) Console.Write("[0, 1] : 2 ", i, j, arr3[i, j]); [0, 0] : 1 [0, 1] : 2 [0, 2] : 3 [1, 0] : 4 [1, 1] : 5 [1, 2] : 6 [0, 0] : 1 [0, 1] : 2 [0, 2] : 3 [1, 0] : 4 [1, 1] : 5 [1, 2] : 6 [0, 0] : 1 [0, 1] : 2 [0, 2] : 3 [1, 0] : 4 [1, 1] : 5 [1, 2] : 6

12 다차원배열 다차원배열 2 차원이상의차원을갖는배열 2 차원배열의선언및사용방법동일 3 차원배열의선언및초기화예 int[,,] array = new int[4, 3, 2] 1, 2, 3, 4, 5, 6, 1, 4, 2, 5, 3, 6, 6, 5, 4, 3, 2, 1, 6, 3, 5, 2, 4, 1, ;

13 class MainApp static void Main(string[ ] args) int[,,] array = new int[4, 3, 2] 1, 2, 3, 4, 5, 6, 1, 4, 2, 5, 3, 6, 6, 5, 4, 3, 2, 1, 6, 3, 5, 2, 4, 1, ; for (int i = 0; i < array.getlength(0); i++) for (int j = 0; j < array.getlength(1); j++) Console.Write(" "); for (int k = 0; k < array.getlength(2); k++) Console.Write("0 ", array[i, j, k]); Console.Write(" ");

14 가변배열 가변배열 (Jagged Array) 배열의요소가배열이므로배열요소마다차원과크기가다르게지정가능 데이터형식 [ ][ ] 배열이름 = new 데이터형식 [ 가변배열의용량 ][ ]; int[][] jagged = new int[3][]; jagged[0] = new int[5] 1, 2, 3, 4, 5 ; jagged[1] = new int[] 10, 20, 30 ; jagged[2] = new int[] 100, 200 ; int[][] jagged2 = new int[2][] new int[] 1000, 2000, new int[4] 6, 7, 8, 9 ; jagged jagged[0] jagged[1] jagged[2]

15 class MainApp static void Main(string[ ] args) int[ ][ ] jagged = new int[3][ ]; jagged[0] = new int[5] 1, 2, 3, 4, 5 ; jagged[1] = new int[ ] 10, 20, 30 ; jagged[2] = new int[ ] 100, 200 ; foreach( int[ ] arr in jagged ) Console.Write("Length : 0, ", arr.length); foreach( int e in arr) Console.Write("0 ", e ); Console.WriteLine(""); Console.WriteLine(""); int[ ][ ] jagged2 = new int[2][ ] new int[ ] 1000, 2000, new int[4] 6, 7, 8, 9 ; foreach (int [ ] arr in jagged2) Console.Write("Length : 0, ", arr.length); foreach (int e in arr) Console.Write("0 ", e); Length : 5, Length : 3, Length : 2, Length : 2, Length : 4,

16 컬렉션 컬렉션 (collection) 같은성격의데이터를모아놓은자료구조 용량크기지정불필요, 필요에따라메모리용량증감 배열도.NET 프레임워크가제공하는컬렉션중의하나 ICollection 인터페이스를상속 ArrayList 리스트 (list) 자료구조지원 배열과유사 [ ] 사용원소접근 Queue Stack HashTable

17 컬렉션 ArrayList 리스트 (list) 자료구조지원 배열과유사 [ ] 사용원소접근 주소메소드 Add( ) : 컬렉션맨마지막에새원소추가 RemoveAt( ) : 특정인덱스위치의원소삭제 Insert( ) : 원하는위치에새원소추가 ArrayList list = new ArrayList(); list.add( 10 ); list.add( 20 ); list.add( 30 ); list.removeat( 1 ); // 20 을삭제 list.insert( 25, 1 ); // 25 를 1 번인덱스에삽입. 즉, 10 과 30 사이에 25 를삽입

18 ArrayList 사용예 class MainApp static void Main(string[] args) ArrayList list = new ArrayList(); for (int i = 0; i < 5; i++) list.add(i); foreach (object obj in list) Console.Write("0 ", obj); list.removeat(2); foreach (object obj in list) Console.Write("0 ", obj); list.insert(2, 2); foreach (object obj in list) Console.Write("0 ", obj); list.add("abc"); list.add("def"); for ( int i=0; i<list.count; i++ ) Console.Write("0 ", list[i]); abc def

19 컬렉션 Queue 선입선출 (First In First Out) 구조의자료구조 주요메소드 Enqueue( ) : 큐의맨끝에원소추가 Dequeue( ) : 큐의맨앞에서원소삭제및반환 class MainApp static void Main(string[] args) Queue que = new Queue(); que.enqueue(1); que.enqueue(2); que.enqueue(3); que.enqueue(4); que.enqueue(5); while (que.count > 0) Console.WriteLine(que.Dequeue());

20 컬렉션 Stack 선입후출 (Firs In Last Out) 구조의자료구조 주요메소드 Push( ) Pop( ) class MainApp static void Main(string[ ] args) Stack stack = new Stack(); stack.push(1); stack.push(2); stack.push(3); stack.push(4); stack.push(5); while (stack.count > 0) Console.WriteLine(stack.Pop());

21 컬렉션 Hash Table 키 (Key) 와값 (Value) 으로이루어진데이터관리 키의해싱 (Hashing) 을통해테이블내의주소계산 탐색속도빠름 키를인덱스처럼사용 class MainApp static void Main(string[] args) Hashtable ht = new Hashtable( ); ht[" 하나 "] = "one"; ht[" 둘 "] = "two"; ht[" 셋 "] = "three"; ht[" 넷 "] = "four"; ht[" 다섯 "] = "five"; Console.WriteLine( ht[" 하나 "] ) ; Console.WriteLine( ht[" 둘 "] ); Console.WriteLine( ht[" 셋 "] ); Console.WriteLine( ht[" 넷 "] ); Console.WriteLine( ht[" 다섯 "] );

22 인덱서 인덱서 (Indexer) 인덱스를사용하여객체내의데이터를접근할수있도록하는프로퍼티 인덱서선언방법 class 클래스이름 한정자인덱서형식 this[ 형식 index] get // index 를이용하여내부데이터반환 set // index 를이용하여내부데이터저장

23 class MyList private int[ ] array; public MyList( ) array = new int[3]; class MainApp static void Main(string[] args) MyList list = new MyList(); for (int i = 0; i < 5; i++) list[i] = i; public int this[int index] get return array[index]; for (int i = 0; i<list.length; i++) Console.WriteLine(list[i]); set if (index >= array.length) Array.Resize<int>(ref array, index + 1); Console.WriteLine("Array Resized : 0", array.length); array[index] = value; public int Length get return array.length;

24 foreach 가능객체생성방법 foreach 가능객체 IEnumerable 과 IEnumerator 를상속하는형식만지원 class MyList : IEnumerable, IEnumerator // IEnumerator 멤버 public object Current // public void Reset() position = -1; public bool MoveNext() // MyList list = new MyList(); for (int i = 0; i < 5; i++) list[i] = i; // IEnumerable 멤버 public IEnumerator GetEnumerator() for (int i = 0; i < array.length; i++) yield return (array[i]); // foreach (int e in list) Console.WriteLine(e);

25 class MyList : IEnumerable, IEnumerator private int[] array; int position = -1; public MyList() array = new int[3]; public int this[int index] get return array[index]; set if (index >= array.length) Array.Resize<int>(ref array, index + 1); Console.WriteLine("Array Resized : 0", array.length); array[index] = value; // IEnumerator 멤버 public object Current get return array[position]; // IEnumerator 멤버 public bool MoveNext() if (position == array.length - 1) Reset(); return false; position++; return (position < array.length); public void Reset() position = -1; // IEnumerable 멤버 public IEnumerator GetEnumerator() for (int i = 0; i < array.length; i++) yield return (array[i]); yield return 을만나면, return 이일어나고, 다음번호출에지난번이후부분에서재시작 class MainApp static void Main(string[ ] args) MyList list = new MyList( ); for (int i = 0; i < 5; i++) list[i] = i; foreach (int e in list) Console.WriteLine(e);

Microsoft PowerPoint - 07-C#-2-기초문법.ppt [호환 모드]

Microsoft PowerPoint - 07-C#-2-기초문법.ppt [호환 모드] 기본자료형 연산자와제어문 배열 컬렉션과반복자 순천향대학교컴퓨터학부이상정 1 기본자료형 순천향대학교컴퓨터학부이상정 2 C# 자료형 C# 은.NET 프레임워크가제공하는 CTS(Common Type System) 자료형을사용 CTS는닷넷기반의여러언어에서공통으로사용되는자료형 CTS 는값 (value) 형과참조형 (reference) 형지원 CTS가제공하는모든데이터형은

More information

PowerPoint Presentation

PowerPoint Presentation 객체지향프로그래밍 클래스, 객체, 메소드 ( 실습 ) 손시운 ssw5176@kangwon.ac.kr 예제 1. 필드만있는클래스 텔레비젼 2 예제 1. 필드만있는클래스 3 예제 2. 여러개의객체생성하기 4 5 예제 3. 메소드가추가된클래스 public class Television { int channel; // 채널번호 int volume; // 볼륨 boolean

More information

Microsoft PowerPoint - CSharp-2-기초문법

Microsoft PowerPoint - CSharp-2-기초문법 2 장. C# 기초문법 자료형 제어문 배열 연산자 순천향대학교컴퓨터학부이상정 1 자료형 순천향대학교컴퓨터학부이상정 2 CTS CTS(Common Type System) 닷넷기반의여러언어에서공통으로사용되는자료형 언어별로서로다른자료형을사용할때발생할수있는호환성문제를해결 값 (Value) 형과참조 (Reference) 형을지원 CTS가제공하는모든자료형은 System.Object를상속받아구현

More information

학습목차 2.1 다차원배열이란 차원배열의주소와값의참조

학습목차 2.1 다차원배열이란 차원배열의주소와값의참조 - Part2- 제 2 장다차원배열이란무엇인가 학습목차 2.1 다차원배열이란 2. 2 2 차원배열의주소와값의참조 2.1 다차원배열이란 2.1 다차원배열이란 (1/14) 다차원배열 : 2 차원이상의배열을의미 1 차원배열과다차원배열의비교 1 차원배열 int array [12] 행 2 차원배열 int array [4][3] 행 열 3 차원배열 int array [2][2][3]

More information

JAVA PROGRAMMING 실습 08.다형성

JAVA PROGRAMMING 실습 08.다형성 2015 학년도 2 학기 1. 추상메소드 선언은되어있으나코드구현되어있지않은메소드 abstract 키워드사용 메소드타입, 이름, 매개변수리스트만선언 public abstract String getname(); public abstract void setname(string s); 2. 추상클래스 abstract 키워드로선언한클래스 종류 추상메소드를포함하는클래스

More information

JAVA 프로그래밍실습 실습 1) 실습목표 - 메소드개념이해하기 - 매개변수이해하기 - 새메소드만들기 - Math 클래스의기존메소드이용하기 ( ) 문제 - 직사각형모양의땅이있다. 이땅의둘레, 면적과대각

JAVA 프로그래밍실습 실습 1) 실습목표 - 메소드개념이해하기 - 매개변수이해하기 - 새메소드만들기 - Math 클래스의기존메소드이용하기 (   ) 문제 - 직사각형모양의땅이있다. 이땅의둘레, 면적과대각 JAVA 프로그래밍실습 실습 1) 실습목표 - 메소드개념이해하기 - 매개변수이해하기 - 새메소드만들기 - Math 클래스의기존메소드이용하기 ( http://java.sun.com/javase/6/docs/api ) 문제 - 직사각형모양의땅이있다. 이땅의둘레, 면적과대각선의길이를계산하는메소드들을작성하라. 직사각형의가로와세로의길이는주어진다. 대각선의길이는 Math클래스의적절한메소드를이용하여구하라.

More information

gnu-lee-oop-kor-lec11-1-chap15

gnu-lee-oop-kor-lec11-1-chap15 어서와 Java 는처음이지! 제 15 장컬렉션 컬렉션 (collection) 은자바에서자료구조를구현한클래스 자료구조로는리스트 (list), 스택 (stack), 큐 (queue), 집합 (set), 해쉬테이블 (hash table) 등이있다. 자바는컬렉션인터페이스와컬렉션클래스로나누어서제공한다. 자바에서는컬렉션인터페이스를구현한클래스도함께제공하므로이것을간단하게사용할수도있고아니면각자필요에맞추어인터페이스를자신의클래스로구현할수도있다.

More information

PowerPoint Presentation

PowerPoint Presentation Package Class 3 Heeseung Jo 목차 section 1 패키지개요와패키지의사용 section 2 java.lang 패키지의개요 section 3 Object 클래스 section 4 포장 (Wrapper) 클래스 section 5 문자열의개요 section 6 String 클래스 section 7 StringBuffer 클래스 section

More information

gnu-lee-oop-kor-lec06-3-chap7

gnu-lee-oop-kor-lec06-3-chap7 어서와 Java 는처음이지! 제 7 장상속 Super 키워드 상속과생성자 상속과다형성 서브클래스의객체가생성될때, 서브클래스의생성자만호출될까? 아니면수퍼클래스의생성자도호출되는가? class Base{ public Base(String msg) { System.out.println("Base() 생성자 "); ; class Derived extends Base

More information

슬라이드 1

슬라이드 1 컬렉션프레임워크 (Collection Framework) 의정의 - 다수의데이터를쉽게처리할수있는표준화된방법을제공하는클래스들 - 데이터의집합을다루고표현하기위한단일화된구조 (architecture) - JDK 1.2 이전까지는 Vector, Hashtable, Properties와같은컬렉션클래스로서로다른각자의방식으로처리 - 컬렉션프레임워크는다수의데이터를다루는데필요한다양하고풍부한클래스들을제공하므로프로그래머의부담을상당부분덜어준다.

More information

JAVA PROGRAMMING 실습 05. 객체의 활용

JAVA PROGRAMMING 실습 05. 객체의 활용 public class Person{ public String name; public int age; } public Person(){ } public Person(String s, int a){ name = s; age = a; } public String getname(){ return name; } @ 객체의선언 public static void main(string

More information

PowerPoint Presentation

PowerPoint Presentation Class - Property Jo, Heeseung 목차 section 1 클래스의일반구조 section 2 클래스선언 section 3 객체의생성 section 4 멤버변수 4-1 객체변수 4-2 클래스변수 4-3 종단 (final) 변수 4-4 멤버변수접근방법 section 5 멤버변수접근한정자 5-1 public 5-2 private 5-3 한정자없음

More information

JAVA PROGRAMMING 실습 02. 표준 입출력

JAVA PROGRAMMING 실습 02. 표준 입출력 # 메소드의구조자주반복하여사용하는내용에대해특정이름으로정의한묶음 반환형메소드이름 ( 매개변수 ) { 실행문장 1; : 실행문장 N; } 메소드의종류 Call By Name : 메서드의이름에의해호출되는메서드로특정매개변수없이실행 Call By Value : 메서드를이름으로호출할때특정매개변수를전달하여그값을기초로실행하는메서드 Call By Reference : 메서드호출시매개변수로사용되는값이특정위치를참조하는

More information

Microsoft PowerPoint 자바-기본문법(Ch2).pptx

Microsoft PowerPoint 자바-기본문법(Ch2).pptx 자바기본문법 1. 기본사항 2. 자료형 3. 변수와상수 4. 연산자 1 주석 (Comments) 이해를돕기위한설명문 종류 // /* */ /** */ 활용예 javadoc HelloApplication.java 2 주석 (Comments) /* File name: HelloApplication.java Created by: Jung Created on: March

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 System Software Experiment 1 Lecture 5 - Array Spring 2019 Hwansoo Han (hhan@skku.edu) Advanced Research on Compilers and Systems, ARCS LAB Sungkyunkwan University http://arcs.skku.edu/ 1 배열 (Array) 동일한타입의데이터가여러개저장되어있는저장장소

More information

<4D F736F F F696E74202D20C1A63038C0E520C5ACB7A1BDBABFCD20B0B4C3BC4928B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20C1A63038C0E520C5ACB7A1BDBABFCD20B0B4C3BC4928B0ADC0C729205BC8A3C8AF20B8F0B5E55D> Power Java 제 8 장클래스와객체 I 이번장에서학습할내용 클래스와객체 객체의일생직접 메소드클래스를 필드작성해 UML 봅시다. QUIZ 1. 객체는 속성과 동작을가지고있다. 2. 자동차가객체라면클래스는 설계도이다. 먼저앞장에서학습한클래스와객체의개념을복습해봅시다. 클래스의구성 클래스 (class) 는객체의설계도라할수있다. 클래스는필드와메소드로이루어진다.

More information

쉽게 풀어쓴 C 프로그래밍

쉽게 풀어쓴 C 프로그래밍 Power Java 제 11 장상속 이번장에서학습할내용 상속이란? 상속의사용 메소드재정의 접근지정자 상속과생성자 Object 클래스 종단클래스 상속을코드를재사용하기위한중요한기법입니다. 상속이란? 상속의개념은현실세계에도존재한다. 상속의장점 상속의장점 상속을통하여기존클래스의필드와메소드를재사용 기존클래스의일부변경도가능 상속을이용하게되면복잡한 GUI 프로그램을순식간에작성

More information

PowerPoint Presentation

PowerPoint Presentation Package Class 1 Heeseung Jo 목차 section 1 패키지개요와패키지의사용 section 2 java.lang 패키지의개요 section 3 Object 클래스 section 4 포장 (Wrapper) 클래스 section 5 문자열의개요 section 6 String 클래스 section 7 StringBuffer 클래스 section

More information

PowerPoint Presentation

PowerPoint Presentation 자바프로그래밍 1 배열 손시운 ssw5176@kangwon.ac.kr 배열이필요한이유 예를들어서학생이 10 명이있고성적의평균을계산한다고가정하자. 학생 이 10 명이므로 10 개의변수가필요하다. int s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; 하지만만약학생이 100 명이라면어떻게해야하는가? int s0, s1, s2, s3, s4,

More information

PowerPoint Presentation

PowerPoint Presentation 자바프로그래밍 1 클래스와메소드심층연구 ( 실습 ) 손시운 ssw5176@kangwon.ac.kr 예제 1. 접근제어 class A { private int a; int b; public int c; // 전용 // 디폴트 // 공용 public class Test { public static void main(string args[]) { A obj = new

More information

(8) getpi() 함수는정적함수이므로 main() 에서호출할수있다. (9) class Circle private double radius; static final double PI= ; // PI 이름으로 로초기화된정적상수 public

(8) getpi() 함수는정적함수이므로 main() 에서호출할수있다. (9) class Circle private double radius; static final double PI= ; // PI 이름으로 로초기화된정적상수 public Chapter 9 Lab 문제정답 1. public class Circle private double radius; static final double PI=3.141592; // PI 이름으로 3.141592 로초기화된정적상수 (1) public Circle(double r) radius = r; (2) public double getradius() return

More information

q 이장에서다룰내용 1 객체지향프로그래밍의이해 2 객체지향언어 : 자바 2

q 이장에서다룰내용 1 객체지향프로그래밍의이해 2 객체지향언어 : 자바 2 객체지향프로그래밍 IT CookBook, 자바로배우는쉬운자료구조 q 이장에서다룰내용 1 객체지향프로그래밍의이해 2 객체지향언어 : 자바 2 q 객체지향프로그래밍의이해 v 프로그래밍기법의발달 A 군의사업발전 1 단계 구조적프로그래밍방식 3 q 객체지향프로그래밍의이해 A 군의사업발전 2 단계 객체지향프로그래밍방식 4 q 객체지향프로그래밍의이해 v 객체란무엇인가

More information

PowerPoint Presentation

PowerPoint Presentation 객체지향프로그래밍 오류처리 손시운 ssw5176@kangwon.ac.kr 오류메시지를분석한다. 오류메시지에서많은내용을알수있다. 2 디버깅 디버거를사용하면프로그램에서쉽게오류를감지하고진단할수있다. 디버거는중단점을설정하여서프로그램의실행을제어할수있으며문장 단위로실행하거나변수의값을살펴볼수있다. 3 이클립스에서디버깅 4 이클립스에서디버깅 5 이클립스의디버깅명령어 6 예외처리

More information

Design Issues

Design Issues 11 COMPUTER PROGRAMMING INHERIATANCE CONTENTS OVERVIEW OF INHERITANCE INHERITANCE OF MEMBER VARIABLE RESERVED WORD SUPER METHOD INHERITANCE and OVERRIDING INHERITANCE and CONSTRUCTOR 2 Overview of Inheritance

More information

슬라이드 1

슬라이드 1 UNIT 6 배열 로봇 SW 교육원 3 기 학습목표 2 배열을사용핛수있다. 배열 3 배열 (Array) 이란? 같은타입 ( 자료형 ) 의여러변수를하나의묶음으로다루는것을배열이라고함 같은타입의많은양의데이터를다룰때효과적임 // 학생 30 명의점수를저장하기위해.. int student_score1; int student_score2; int student_score3;...

More information

설계란 무엇인가?

설계란 무엇인가? 금오공과대학교 C++ 프로그래밍 jhhwang@kumoh.ac.kr 컴퓨터공학과 황준하 5 강. 배열, 포인터, 참조목차 배열 포인터 C++ 메모리구조 주소연산자 포인터 포인터연산 배열과포인터 메모리동적할당 문자열 참조 1 /20 5 강. 배열, 포인터, 참조배열 배열 같은타입의변수여러개를하나의변수명으로처리 int Ary[10]; 총 10 개의변수 : Ary[0]~Ary[9]

More information

Microsoft Word - java19-1-midterm-answer.doc

Microsoft Word - java19-1-midterm-answer.doc 중간고사 담당교수 : 단국대학교응용컴퓨터공학박경신 답은반드시답안지에기술할것. 공간이부족할경우반드시답안지몇쪽의뒤에있다고명기한후기술할것. 그외의경우의답안지뒤쪽이나연습지에기술한내용은답안으로인정안함. 답에는반드시네모를쳐서확실히표시할것. 답안지에학과, 학번, 이름외에본인의암호 (4자리숫자 ) 를기입하면성적공고시학번대신암호를 사용할것임. 1. 다음질문에답을하라. (55

More information

PowerPoint Presentation

PowerPoint Presentation 객체지향프로그래밍 클래스와메소드심층연구 ( 실습 ) 손시운 ssw5176@kangwon.ac.kr 예제 1. 접근제어 class A { private int a; int b; public int c; // 전용 // 디폴트 // 공용 public class Test { public static void main(string args[]) { A obj = new

More information

Microsoft PowerPoint - ch07 - 포인터 pm0415

Microsoft PowerPoint - ch07 - 포인터 pm0415 2015-1 프로그래밍언어 7. 포인터 (Pointer), 동적메모리할당 2015 년 4 월 4 일 교수김영탁 영남대학교공과대학정보통신공학과 (Tel : +82-53-810-2497; Fax : +82-53-810-4742 http://antl.yu.ac.kr/; E-mail : ytkim@yu.ac.kr) Outline 포인터 (pointer) 란? 간접참조연산자

More information

유니티 변수-함수.key

유니티 변수-함수.key C# 1 or 16 (Binary or Hex) 1:1 C# C# (Java, Python, Go ) (0101010 ). (Variable) : (Value) (Variable) : (Value) ( ) (Variable) : (Value) ( ) ; (Variable) : (Value) ( ) ; = ; (Variable) : (Value) (Variable)

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 인터페이스 배효철 th1g@nate.com 1 목차 인터페이스의역할 인터페이스선언 인터페이스구현 인터페이스사용 타입변환과다형성 인터페이스상속 디폴트메소드와인터페이스확장 2 인터페이스의역할 인터페이스란? 개발코드와객체가서로통신하는접점 개발코드는인터페이스의메소드만알고있으면 OK 인터페이스의역할 개발코드가객체에종속되지않게 -> 객체교체할수있도록하는역할 개발코드변경없이리턴값또는실행내용이다양해질수있음

More information

교육자료

교육자료 THE SYS4U DODUMENT Java Reflection & Introspection 2012.08.21 김진아사원 2012 SYS4U I&C All rights reserved. 목차 I. 개념 1. Reflection 이란? 2. Introspection 이란? 3. Reflection 과 Introspection 의차이점 II. 실제사용예 1. Instance의생성

More information

07 자바의 다양한 클래스.key

07 자바의 다양한 클래스.key [ 07 ] . java.lang Object, Math, String, StringBuffer Byte, Short, Integer, Long, Float, Double, Boolean, Character. java.util Random, StringTokenizer Calendar, GregorianCalendar, Date. Collection, List,

More information

Microsoft PowerPoint - hci2-lecture4.ppt [호환 모드]

Microsoft PowerPoint - hci2-lecture4.ppt [호환 모드] Overview 메소드와인자 & 배열 321190 2017 년가을학기 9/12/2017 박경신 효과적인메소드호출의방법 중첩메소드와재귀메소드 메소드와변수와의관계 메소드에인자를전달하여호출 메소드오버로딩 배열의의미와필요성 1차원배열, 다차원배열 배열의요소에접근하는방법에대한이해 배열에서지원하는속성과메소드활용 Class/Method C# FCL에는많은클래스들이정의되어있음

More information

비긴쿡-자바 00앞부속

비긴쿡-자바 00앞부속 IT COOKBOOK 14 Java P r e f a c e Stay HungryStay Foolish 3D 15 C 3 16 Stay HungryStay Foolish CEO 2005 L e c t u r e S c h e d u l e 1 14 PPT API C A b o u t T h i s B o o k IT CookBook for Beginner Chapter

More information

PowerPoint Presentation

PowerPoint Presentation public class SumTest { public static void main(string a1[]) { int a, b, sum; a = Integer.parseInt(a1[0]); b = Integer.parseInt(a1[1]); sum = a + b ; // 두수를더하는부분입니다 System.out.println(" 두수의합은 " + sum +

More information

PowerPoint Presentation

PowerPoint Presentation 객체지향프로그래밍 인터페이스, 람다식, 패키지 ( 실습 ) 손시운 ssw5176@kangwon.ac.kr 예제 1. 홈네트워킹 public interface RemoteControl { public void turnon(); // 가전제품을켠다. public void turnoff(); // 가전제품을끈다. 인터페이스를구현 public class Television

More information

Microsoft PowerPoint - ch09 - 연결형리스트, Stack, Queue와 응용 pm0100

Microsoft PowerPoint - ch09 - 연결형리스트, Stack, Queue와 응용 pm0100 2015-1 프로그래밍언어 9. 연결형리스트, Stack, Queue 2015 년 5 월 4 일 교수김영탁 영남대학교공과대학정보통신공학과 (Tel : +82-53-810-2497; Fax : +82-53-810-4742 http://antl.yu.ac.kr/; E-mail : ytkim@yu.ac.kr) 연결리스트 (Linked List) 연결리스트연산 Stack

More information

untitled

untitled - -, (insert) (delete) - - (insert) (delete) (top ) - - (insert) (rear) (delete) (front) A A B top A B C top push(a) push(b) push(c) A B top pop() top A B D push(d) top #define MAX_STACK_SIZE 100 int

More information

PowerPoint Presentation

PowerPoint Presentation public class SumTest { public static void main(string a1[]) { int a, b, sum; a = Integer.parseInt(a1[0]); b = Integer.parseInt(a1[1]); sum = a + b ; // 두수를더하는부분입니다 System.out.println(" 두수의합은 " + sum +

More information

1. 객체의생성과대입 int 형변수 : 선언과동시에초기화하는방법 (C++) int a = 3; int a(3); // 기본타입역시클래스와같이처리가능 객체의생성 ( 복습 ) class CPoint private : int x, y; public : CPoint(int a

1. 객체의생성과대입 int 형변수 : 선언과동시에초기화하는방법 (C++) int a = 3; int a(3); // 기본타입역시클래스와같이처리가능 객체의생성 ( 복습 ) class CPoint private : int x, y; public : CPoint(int a 6 장복사생성자 객체의생성과대입객체의값에의한전달복사생성자디폴트복사생성자복사생성자의재정의객체의값에의한반환임시객체 C++ 프로그래밍입문 1. 객체의생성과대입 int 형변수 : 선언과동시에초기화하는방법 (C++) int a = 3; int a(3); // 기본타입역시클래스와같이처리가능 객체의생성 ( 복습 ) class CPoint private : int x, y;

More information

chap01_time_complexity.key

chap01_time_complexity.key 1 : (resource),,, 2 (time complexity),,, (worst-case analysis) (average-case analysis) 3 (Asymptotic) n growth rate Θ-, Ο- ( ) 4 : n data, n/2. int sample( int data[], int n ) { int k = n/2 ; return data[k]

More information

chap 5: Trees

chap 5: Trees 5. Threaded Binary Tree 기본개념 n 개의노드를갖는이진트리에는 2n 개의링크가존재 2n 개의링크중에 n + 1 개의링크값은 null Null 링크를다른노드에대한포인터로대체 Threads Thread 의이용 ptr left_child = NULL 일경우, ptr left_child 를 ptr 의 inorder predecessor 를가리키도록변경

More information

금오공대 컴퓨터공학전공 강의자료

금오공대 컴퓨터공학전공 강의자료 C 프로그래밍프로젝트 Chap 14. 포인터와함수에대한이해 2013.10.09. 오병우 컴퓨터공학과 14-1 함수의인자로배열전달 기본적인인자의전달방식 값의복사에의한전달 val 10 a 10 11 Department of Computer Engineering 2 14-1 함수의인자로배열전달 배열의함수인자전달방식 배열이름 ( 배열주소, 포인터 ) 에의한전달 #include

More information

설계란 무엇인가?

설계란 무엇인가? 금오공과대학교 C++ 프로그래밍 jhhwang@kumoh.ac.kr 컴퓨터공학과 황준하 6 강. 함수와배열, 포인터, 참조목차 함수와포인터 주소값의매개변수전달 주소의반환 함수와배열 배열의매개변수전달 함수와참조 참조에의한매개변수전달 참조의반환 프로그래밍연습 1 /15 6 강. 함수와배열, 포인터, 참조함수와포인터 C++ 매개변수전달방법 값에의한전달 : 변수값,

More information

PowerPoint Presentation

PowerPoint Presentation 객체지향프로그래밍 오류처리 손시운 ssw5176@kangwon.ac.kr 오류메시지를분석한다. 오류메시지에서많은내용을알수있다. 2 디버깅 디버거를사용하면프로그램에서쉽게오류를감지하고진단할수있다. 디버거는중단점을설정하여서프로그램의실행을제어할수있으며문장 단위로실행하거나변수의값을살펴볼수있다. 3 이클립스에서디버깅 4 이클립스에서디버깅 5 이클립스의디버깅명령어 6 예외처리

More information

JVM 메모리구조

JVM 메모리구조 조명이정도면괜찮조! 주제 JVM 메모리구조 설미라자료조사, 자료작성, PPT 작성, 보고서작성. 발표. 조장. 최지성자료조사, 자료작성, PPT 작성, 보고서작성. 발표. 조원 이용열자료조사, 자료작성, PPT 작성, 보고서작성. 이윤경 자료조사, 자료작성, PPT작성, 보고서작성. 이수은 자료조사, 자료작성, PPT작성, 보고서작성. 발표일 2013. 05.

More information

슬라이드 1

슬라이드 1 UNIT 16 예외처리 로봇 SW 교육원 3 기 최상훈 학습목표 2 예외처리구문 try-catch-finally 문을사용핛수있다. 프로그램오류 3 프로그램오류의종류 컴파일에러 (compile-time error) : 컴파일실행시발생 럮타임에러 (runtime error) : 프로그램실행시발생 에러 (error) 프로그램코드에의해서해결될수없는심각핚오류 ex)

More information

Microsoft PowerPoint - 04-UDP Programming.ppt

Microsoft PowerPoint - 04-UDP Programming.ppt Chapter 4. UDP Dongwon Jeong djeong@kunsan.ac.kr http://ist.kunsan.ac.kr/ Dept. of Informatics & Statistics 목차 UDP 1 1 UDP 개념 자바 UDP 프로그램작성 클라이언트와서버모두 DatagramSocket 클래스로생성 상호간통신은 DatagramPacket 클래스를이용하여

More information

Microsoft PowerPoint - Lect04.pptx

Microsoft PowerPoint - Lect04.pptx OBJECT ORIENTED PROGRAMMING Object Oriented Programming 이강의록은 Power Java 저자의강의록을사용했거나재편집된것입니다. Class 와 object Class 와객체 클래스의일생 메소드 필드 String Object Class 와객체 3 클래스 클래스의구성 클래스 (l (class): 객체를만드는설계도 클래스로부터만들어지는각각의객체를특별히그클래스의인스턴스

More information

목차 포인터의개요 배열과포인터 포인터의구조 실무응용예제 C 2

목차 포인터의개요 배열과포인터 포인터의구조 실무응용예제 C 2 제 8 장. 포인터 목차 포인터의개요 배열과포인터 포인터의구조 실무응용예제 C 2 포인터의개요 포인터란? 주소를변수로다루기위한주소변수 메모리의기억공간을변수로써사용하는것 포인터변수란데이터변수가저장되는주소의값을 변수로취급하기위한변수 C 3 포인터의개요 포인터변수및초기화 * 변수데이터의데이터형과같은데이터형을포인터 변수의데이터형으로선언 일반변수와포인터변수를구별하기위해

More information

11장 포인터

11장 포인터 누구나즐기는 C 언어콘서트 제 9 장포인터 이번장에서학습할내용 포인터이란? 변수의주소 포인터의선언 간접참조연산자 포인터연산 포인터와배열 포인터와함수 이번장에서는포인터의기초적인지식을학습한다. 포인터란? 포인터 (pointer): 주소를가지고있는변수 메모리의구조 변수는메모리에저장된다. 메모리는바이트단위로액세스된다. 첫번째바이트의주소는 0, 두번째바이트는 1, 변수와메모리

More information

<322EBCF8C8AF28BFACBDC0B9AEC1A6292E687770>

<322EBCF8C8AF28BFACBDC0B9AEC1A6292E687770> 연습문제해답 5 4 3 2 1 0 함수의반환값 =15 5 4 3 2 1 0 함수의반환값 =95 10 7 4 1-2 함수의반환값 =3 1 2 3 4 5 연습문제해답 1. C 언어에서의배열에대하여다음중맞는것은? (1) 3차원이상의배열은불가능하다. (2) 배열의이름은포인터와같은역할을한다. (3) 배열의인덱스는 1에서부터시작한다. (4) 선언한다음, 실행도중에배열의크기를변경하는것이가능하다.

More information

Microsoft PowerPoint - 2강

Microsoft PowerPoint - 2강 컴퓨터과학과 김희천교수 학습개요 Java 언어문법의기본사항, 자료형, 변수와상수선언및사용법, 각종연산자사용법, if/switch 등과같은제어문사용법등에대해설명한다. 또한 C++ 언어와선언 / 사용방법이다른 Java의배열선언및사용법에대해서설명한다. Java 언어의효과적인활용을위해서는기본문법을이해하는것이중요하다. 객체지향의기본개념에대해알아보고 Java에서어떻게객체지향적요소를적용하고있는지살펴본다.

More information

PowerPoint Presentation

PowerPoint Presentation 객체지향프로그래밍 클래스, 객체, 메소드 손시운 ssw5176@kangwon.ac.kr 실제세계는객체로이루어진다. 2 객체와메시지 3 객체지향이란? 실제세계를모델링하여소프트웨어를개발하는방법 4 객체 5 객체란? 객체 (Object) 는상태와동작을가지고있다. 객체의상태 (state) 는객체의특징값 ( 속성 ) 이다. 객체의동작 (behavior) 또는행동은객체가취할수있는동작

More information

ilist.add(new Integer(1))과 같이 사용하지 않고 ilist.add(1)과 같이 사용한 것은 자바 5.0에 추가된 기본 자료형과 해당 객체 자료 형과의 오토박싱/언박싱 기능을 사용한 것으로 오토박싱이란 자바 컴파일러가 객체를 요구하는 곳에 기본 자료형

ilist.add(new Integer(1))과 같이 사용하지 않고 ilist.add(1)과 같이 사용한 것은 자바 5.0에 추가된 기본 자료형과 해당 객체 자료 형과의 오토박싱/언박싱 기능을 사용한 것으로 오토박싱이란 자바 컴파일러가 객체를 요구하는 곳에 기본 자료형 바에 제네릭스(generics)를 도입하기 위한 연구는 이미 8년 전인 1996년부터라고 한다. 실제로 자바에 제네릭스를 도입하 는 몇 가지 방안들이 논문으로 나오기 시작한 것이 1998년 초임을 감 안하면 무려 8년이 지난 후에야 자바 5.0에 전격 채택되었다는 것은 이것이 얼마나 어려운 일이었나 하는 것을 보여준다. 자바의 스펙을 결정하는 표준화 절차인

More information

JAVA PROGRAMMING 실습 05. 객체의 활용

JAVA PROGRAMMING 실습 05. 객체의 활용 2015 학년도 2 학기 public class Person{ public String name; public int age; public Person(){ public Person(String s, int a){ name = s; age = a; public String getname(){ return name; @ 객체의선언 public static void

More information

슬라이드 1

슬라이드 1 -Part3- 제 4 장동적메모리할당과가변인 자 학습목차 4.1 동적메모리할당 4.1 동적메모리할당 4.1 동적메모리할당 배울내용 1 프로세스의메모리공간 2 동적메모리할당의필요성 4.1 동적메모리할당 (1/6) 프로세스의메모리구조 코드영역 : 프로그램실행코드, 함수들이저장되는영역 스택영역 : 매개변수, 지역변수, 중괄호 ( 블록 ) 내부에정의된변수들이저장되는영역

More information

Microsoft PowerPoint - hci2-lecture4 [호환 모드]

Microsoft PowerPoint - hci2-lecture4 [호환 모드] Overview 메소드와인자 & 배열 321190 2012 년가을학기 9/19/2012 박경신 효과적인메소드호출의방법 중첩메소드와재귀메소드 메소드와변수와의관계 메소드에인자를전달하여호출 메소드오버로딩 배열의의미와필요성 1 차원배열, 다차원배열 배열의요소에접근하는방법에대한이해 배열에서지원하는속성과메소드활용 Class/Method C# FCL 에는많은클래스들이정의되어있음

More information

02장.배열과 클래스

02장.배열과 클래스 ---------------- DATA STRUCTURES USING C ---------------- CHAPTER 배열과구조체 1/20 많은자료의처리? 배열 (array), 구조체 (struct) 성적처리프로그램에서 45 명의성적을저장하는방법 주소록프로그램에서친구들의다양한정보 ( 이름, 전화번호, 주소, 이메일등 ) 를통합하여저장하는방법 홍길동 이름 :

More information

A Hierarchical Approach to Interactive Motion Editing for Human-like Figures

A Hierarchical Approach to Interactive Motion Editing for Human-like Figures 단일연결리스트 (Singly Linked List) 신찬수 연결리스트 (linked list)? tail 서울부산수원용인 null item next 구조체복습 struct name_card { char name[20]; int date; } struct name_card a; // 구조체변수 a 선언 a.name 또는 a.date // 구조체 a의멤버접근 struct

More information

JAVA PROGRAMMING 실습 02. 표준 입출력

JAVA PROGRAMMING 실습 02. 표준 입출력 # 왜생겼나요..? : 절차지향언어가가진단점을보완하고다음의목적을달성하기위해..! 1. 소프트웨어생산성향상 객체지향소프트웨어를새로만드는경우이미만든개체지향소프트웨어를상속받거나객체를 가져다재사용할수있어부분수정을통해소프트웨어를다시만드는부담줄임. 2. 실세계에대한쉬운모델링 실세계의일은절차나과정보다는일과관련된많은물체들의상호작용으로묘사. 캡슐화 메소드와데이터를클래스내에선언하고구현

More information

제11장 프로세스와 쓰레드

제11장 프로세스와 쓰레드 제9장자바쓰레드 9.1 Thread 기초 (1/5) 프로그램 명령어들의연속 (a sequence of instruction) 프로세스 / Thread 실행중인프로그램 (program in execution) 프로세스생성과실행을위한함수들 자바 Thread 2 9.1 Thread 기초 (2/5) 프로세스단위작업의문제점 프로세스생성시오버헤드 컨텍스트스위치오버헤드

More information

신림프로그래머_클린코드.key

신림프로그래머_클린코드.key CLEAN CODE 6 11st Front Dev. Team 6 1. 2. 3. checked exception 4. 5. 6. 11 : 2 4 : java (50%), javascript (35%), SQL/PL-SQL (15%) : Spring, ibatis, Oracle, jquery ? , (, ) ( ) 클린코드를 무시한다면 . 6 1. ,,,!

More information

예제 2) Test.java class A intvar= 10; void method() class B extends A intvar= 20; 1"); void method() 2"); void method1() public class Test 3"); args) A

예제 2) Test.java class A intvar= 10; void method() class B extends A intvar= 20; 1); void method() 2); void method1() public class Test 3); args) A 제 10 장상속 예제 1) ConstructorTest.java class Parent public Parent() super - default"); public Parent(int i) this("hello"); super(int) constructor" + i); public Parent(char c) this(); super(char) constructor

More information

PowerPoint Presentation

PowerPoint Presentation Class : Method Jo, Heeseung 목차 section 1 생성자 (Constructor) section 2 생성자오버로딩 (Overloading) section 3 예약어 this section 4 메소드 4-1 접근한정자 4-2 클래스메소드 4-3 final, abstract, synchronized 메소드 4-4 메소드반환값 (return

More information

Microsoft PowerPoint - Lect07.pptx

Microsoft PowerPoint - Lect07.pptx 이강의록은 Power Java 저자의강의록을사용했거나재편집된것입니다. Package 개념 Package 묶는방법사용하기기본 Package Utility Package Generic Class Generic Method Collection ArrayList LinkedList Set Queue Map Collection Class 3 패키지 (package)

More information

쉽게 풀어쓴 C 프로그래밍

쉽게 풀어쓴 C 프로그래밍 Power Java 제 22 장제네릭과컬렉션 이번장에서학습할내용 제네릭클래스 제네릭메소드 컬렉션 ArrayList LinkedList Set Queue Map Collections 클래스 일반적인하나의코드로다양한자료형을처리하는기법을살펴봅시다. 제네릭이란? 제네릭프로그래밍 (generic programming) 다양한타입의객체를동일한코드로처리하는기법 제네릭은컬렉션라이브러리에많이사용

More information

목차 INDEX JSON? - JSON 개요 - JSONObject - JSONArray 서울시공공데이터 API 살펴보기 - 요청인자살펴보기 - Result Code - 출력값 HttpClient - HttpHelper 클래스작성 - JSONParser 클래스작성 공공

목차 INDEX JSON? - JSON 개요 - JSONObject - JSONArray 서울시공공데이터 API 살펴보기 - 요청인자살펴보기 - Result Code - 출력값 HttpClient - HttpHelper 클래스작성 - JSONParser 클래스작성 공공 메신저의새로운혁신 채팅로봇 챗봇 (Chatbot) 입문하기 소 이 메 속 : 시엠아이코리아 름 : 임채문 일 : soulgx@naver.com 1 목차 INDEX JSON? - JSON 개요 - JSONObject - JSONArray 서울시공공데이터 API 살펴보기 - 요청인자살펴보기 - Result Code - 출력값 HttpClient - HttpHelper

More information

2002년 2학기 자료구조

2002년 2학기 자료구조 자료구조 (Data Structures) Chapter 1 Basic Concepts Overview : Data (1) Data vs Information (2) Data Linear list( 선형리스트 ) - Sequential list : - Linked list : Nonlinear list( 비선형리스트 ) - Tree : - Graph : (3)

More information

03_queue

03_queue Queue Data Structures and Algorithms 목차 큐의이해와 ADT 정의 큐의배열기반구현 큐의연결리스트기반구현 큐의활용 덱 (Deque) 의이해와구현 Data Structures and Algorithms 2 큐의이해와 ADT 정의 Data Structures and Algorithms 3 큐 (Stack) 의이해와 ADT 정의 큐는 LIFO(Last-in,

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 @ Lesson 4 (Object) (Class) (Instance) (Method) (Constructor) Memory 1 UML 1 @ & 1 (Real World) (Software World) @ &.. () () @ & 2 (Real World) (Software World) OOA/ Modeling Abstraction Instantiation

More information

11강-힙정렬.ppt

11강-힙정렬.ppt 11 (Heap ort) leejaku@shinbiro.com Topics? Heap Heap Opeations UpHeap/Insert, DownHeap/Extract Binary Tree / Index Heap ort Heap ort 11.1 (Priority Queue) Operations ? Priority Queue? Priority Queue tack

More information

(Microsoft Word - \301\337\260\243\260\355\273\347.docx)

(Microsoft Word - \301\337\260\243\260\355\273\347.docx) 내장형시스템공학 (NH466) 중간고사 학번 : 이름 : 문제 배점 점수 1 20 2 20 3 20 4 20 5 10 6 10 7 15 8 20 9 15 합계 150 1. (20 점 ) 다음용어에대해서설명하시오. (1) 정보은닉 (Information Hiding) (2) 캡슐화 (Encapsulation) (3) 오버로딩 (Overloading) (4) 생성자

More information

JAVA PROGRAMMING 실습 09. 예외처리

JAVA PROGRAMMING 실습 09. 예외처리 2015 학년도 2 학기 예외? 프로그램실행중에발생하는예기치않은사건 예외가발생하는경우 정수를 0으로나누는경우 배열의크기보다큰인덱스로배열의원소를접근하는경우 파일의마지막부분에서데이터를읽으려고하는경우 예외처리 프로그램에문제를발생시키지않고프로그램을실행할수있게적절한조치를취하는것 자바는예외처리기를이용하여예외처리를할수있는기법제공 자바는예외를객체로취급!! 나뉨수를입력하시오

More information

Microsoft PowerPoint - java1-lab5-ImageProcessorTestOOP.pptx

Microsoft PowerPoint - java1-lab5-ImageProcessorTestOOP.pptx 2018 학년도 1 학기 JAVA 프로그래밍 II 514760-1 2018 년봄학기 5/10/2018 박경신 Lab#1 (ImageTest) Lab#1 은영상파일 (Image) 을읽어서정보를출력 Java Tutorials Lesson: Working with Images https://docs.oracle.com/javase/tutorial/2d/images/index.html

More information

쉽게 풀어쓴 C 프로그래밍

쉽게 풀어쓴 C 프로그래밍 Power Java 제 7 장클래스와객체 이번장에서학습할내용 객체지향이란? 객체 메시지 클래스 객체지향의장점 String 클래스 객체지향개념을완벽하게이해해야만객체지향설계의이점을활용할수있다. 실제세계는객체로이루어진다. 객체지향이란? 실제세계를모델링하여소프트웨어를개발하는방법 절차지향과객체지향 절차지향프로그래밍 (procedural programming): 문제를해결하는절차를중요하게생각하는방법

More information

11 템플릿적용 - Java Program Performance Tuning (김명호기술이사)

11 템플릿적용 - Java Program Performance Tuning (김명호기술이사) Java Program Performance Tuning ( ) n (Primes0) static List primes(int n) { List primes = new ArrayList(n); outer: for (int candidate = 2; n > 0; candidate++) { Iterator iter = primes.iterator(); while

More information

Microsoft PowerPoint - C++ 5 .pptx

Microsoft PowerPoint - C++ 5 .pptx C++ 언어프로그래밍 한밭대학교전자. 제어공학과이승호교수 연산자중복 (operator overloading) 이란? 2 1. 연산자중복이란? 1) 기존에미리정의되어있는연산자 (+, -, /, * 등 ) 들을프로그래머의의도에맞도록새롭게정의하여사용할수있도록지원하는기능 2) 연산자를특정한기능을수행하도록재정의하여사용하면여러가지이점을가질수있음 3) 하나의기능이프로그래머의의도에따라바뀌어동작하는다형성

More information

Microsoft PowerPoint - logo_3.ppt [호환 모드]

Microsoft PowerPoint - logo_3.ppt [호환 모드] Logo Programming 학습목표 데이터종류를의미하는데이터타입에대해살펴본다. (LOGO의데이터타입 : 단어, 리스트, 배열 ) 값을저장하는공간인변수에대해살펴본다. 데이터관리하기에대해살펴본다. 2012. 5. 박남제 namjepark@jejunu.ac.kr < 데이터타입 > - 단어 단어단어 (word) 는 1 개이상의문자들을나열한것, 123 같은수도단어

More information

A Dynamic Grid Services Deployment Mechanism for On-Demand Resource Provisioning

A Dynamic Grid Services Deployment Mechanism for On-Demand Resource Provisioning C Programming Practice (II) Contents 배열 문자와문자열 구조체 포인터와메모리관리 구조체 2/17 배열 (Array) (1/2) 배열 동일한자료형을가지고있으며같은이름으로참조되는변수들의집합 배열의크기는반드시상수이어야한다. type var_name[size]; 예 ) int myarray[5] 배열의원소는원소의번호를 0 부터시작하는색인을사용

More information

C# Programming Guide - Types

C# Programming Guide - Types C# Programming Guide - Types 최도경 lifeisforu@wemade.com 이문서는 MSDN 의 Types 를요약하고보충한것입니다. http://msdn.microsoft.com/enus/library/ms173104(v=vs.100).aspx Types, Variables, and Values C# 은 type 에민감한언어이다. 모든

More information

Chapter 4. LISTS

Chapter 4. LISTS C 언어에서리스트구현 리스트의생성 struct node { int data; struct node *link; ; struct node *ptr = NULL; ptr = (struct node *) malloc(sizeof(struct node)); Self-referential structure NULL: defined in stdio.h(k&r C) or

More information

11장 포인터

11장 포인터 Dynamic Memory and Linked List 1 동적할당메모리의개념 프로그램이메모리를할당받는방법 정적 (static) 동적 (dynamic) 정적메모리할당 프로그램이시작되기전에미리정해진크기의메모리를할당받는것 메모리의크기는프로그램이시작하기전에결정 int i, j; int buffer[80]; char name[] = data structure"; 처음에결정된크기보다더큰입력이들어온다면처리하지못함

More information

adfasdfasfdasfasfadf

adfasdfasfdasfasfadf C 4.5 Source code Pt.3 ISL / 강한솔 2019-04-10 Index Tree structure Build.h Tree.h St-thresh.h 2 Tree structure *Concpets : Node, Branch, Leaf, Subtree, Attribute, Attribute Value, Class Play, Don't Play.

More information

자바 프로그래밍

자바 프로그래밍 5 (kkman@mail.sangji.ac.kr) (Class), (template) (Object) public, final, abstract [modifier] class ClassName { // // (, ) Class Circle { int radius, color ; int x, y ; float getarea() { return 3.14159

More information

Microsoft PowerPoint - hci2-lecture12 [호환 모드]

Microsoft PowerPoint - hci2-lecture12 [호환 모드] Serialization C# Serialization 321190 2012 년가을학기 11/28/2012 박경신 Serializaiton( 직렬화 ) 란객체상태를지속시키거나전송할수있는형식으로변환하는과정으로, Serialization 반대로다시객체로변환하는것을 Deserialization 임 Serialization i 을사용하는이유 객체의상태를저장소에보존했다가나중에똑같은복사본을다시만들기위하거나,

More information

쉽게 풀어쓴 C 프로그래밍

쉽게 풀어쓴 C 프로그래밍 제 11 장상속 1. 상속의개념을이해한다. 2. 상속을이용하여자식클래스를작성할수있다. 3. 상속과접근지정자와의관계를이해한다. 4. 상속시생성자와소멸자가호출되는순서를이해한다. 이번장에서만들어볼프로그램 class Circle { int x, y; int radius;... class Rect { int x, y; int width, height;... 중복 상속의개요

More information

PowerPoint Presentation

PowerPoint Presentation Package Class 2 Heeseung Jo 목차 section 1 패키지개요와패키지의사용 section 2 java.lang 패키지의개요 section 3 Object 클래스 section 4 포장 (Wrapper) 클래스 section 5 문자열의개요 section 6 String 클래스 section 7 StringBuffer 클래스 section

More information

Microsoft PowerPoint - Java7.pptx

Microsoft PowerPoint - Java7.pptx HPC & OT Lab. 1 HPC & OT Lab. 2 실습 7 주차 Jin-Ho, Jang M.S. Hanyang Univ. HPC&OT Lab. jinhoyo@nate.com HPC & OT Lab. 3 Component Structure 객체 (object) 생성개념을이해한다. 외부클래스에대한접근방법을이해한다. 접근제어자 (public & private)

More information

JUNIT 실습및발표

JUNIT 실습및발표 JUNIT 실습및발표 JUNIT 접속 www.junit.org DownLoad JUnit JavaDoc API Document 를참조 JUNIT 4.8.1 다운로드 설치파일 (jar 파일 ) 을다운로드 CLASSPATH 를설정 환경변수에서설정 실행할클래스에서 import JUnit 설치하기 테스트실행주석 @Test Test 를실행할 method 앞에붙임 expected

More information

Microsoft PowerPoint - 08-chap06-Queue.ppt

Microsoft PowerPoint - 08-chap06-Queue.ppt / 큐 (QUEUE) Chapter 큐 : 먼저들어온데이터가먼저나가는자료구조 선입선출 (FIFO: First-In First-Out) ( 예 ) 매표소의대기열 큐 Ticket ox Dongwon Jeong djeong@kunsan.ac.kr Department of Kunsan National University 전단 () 후단 () 학습목표 큐 DT 큐의개념및추상데이터타입에대한이해

More information

[ 마이크로프로세서 1] 2 주차 3 차시. 포인터와구조체 2 주차 3 차시포인터와구조체 학습목표 1. C 언어에서가장어려운포인터와구조체를설명할수있다. 2. Call By Value 와 Call By Reference 를구분할수있다. 학습내용 1 : 함수 (Functi

[ 마이크로프로세서 1] 2 주차 3 차시. 포인터와구조체 2 주차 3 차시포인터와구조체 학습목표 1. C 언어에서가장어려운포인터와구조체를설명할수있다. 2. Call By Value 와 Call By Reference 를구분할수있다. 학습내용 1 : 함수 (Functi 2 주차 3 차시포인터와구조체 학습목표 1. C 언어에서가장어려운포인터와구조체를설명할수있다. 2. Call By Value 와 Call By Reference 를구분할수있다. 학습내용 1 : 함수 (Function) 1. 함수의개념 입력에대해적절한출력을발생시켜주는것 내가 ( 프로그래머 ) 작성한명령문을연산, 처리, 실행해주는부분 ( 모듈 ) 자체적으로실행되지않으며,

More information

쉽게 풀어쓴 C 프로그래밍

쉽게 풀어쓴 C 프로그래밍 Power Java 제 9 장생성자와접근제어 이번장에서학습할내용 생성자 정적변수 정적메소드 접근제어 this 클래스간의관계 객체가생성될때초기화를담당하는생성자에대하여살펴봅니다. 생성자 생성자 (contructor): 객체가생성될때에필드에게초기값을제공하고필요한초기화절차를실행하는메소드 생성자의예 class Car { private String color; // 색상

More information

09-interface.key

09-interface.key 9 Database insert(record r): boolean find(key k): Record 1 Record getkey(): Key * Record Key Database.? Key equals(key y): boolean Database insert(record r): boolean find(key k): Record * Database OK 1

More information

Microsoft PowerPoint 세션.ppt

Microsoft PowerPoint 세션.ppt 웹프로그래밍 () 2006 년봄학기 문양세강원대학교컴퓨터과학과 세션변수 (Session Variable) (1/2) 쇼핑몰장바구니 장바구니에서는사용자가페이지를이동하더라도장바구니의구매물품리스트의내용을유지하고있어야함 PHP 에서사용하는일반적인변수는스크립트의수행이끝나면모두없어지기때문에페이지이동시변수의값을유지할수없음 이러한문제점을해결하기위해서 PHP 에서는세션 (session)

More information

Frama-C/JESSIS 사용법 소개

Frama-C/JESSIS 사용법 소개 Frama-C 프로그램검증시스템소개 박종현 @ POSTECH PL Frama-C? C 프로그램대상정적분석도구 플러그인구조 JESSIE Wp Aorai Frama-C 커널 2 ROSAEC 2011 동계워크샵 @ 통영 JESSIE? Frama-C 연역검증플러그인 프로그램분석 검증조건추출 증명 Hoare 논리에기초한프로그램검증도구 사용법 $ frama-c jessie

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 실습 1 배효철 th1g@nate.com 1 목차 조건문 반복문 System.out 구구단 모양만들기 Up & Down 2 조건문 조건문의종류 If, switch If 문 조건식결과따라중괄호 { 블록을실행할지여부결정할때사용 조건식 true 또는 false값을산출할수있는연산식 boolean 변수 조건식이 true이면블록실행하고 false 이면블록실행하지않음 3

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 @ Lesson 2... ( ). ( ). @ vs. logic data method variable behavior attribute method field Flow (Type), ( ) member @ () : C program Method A ( ) Method B ( ) Method C () program : Java, C++, C# data @ Program

More information

슬라이드 1

슬라이드 1 정적메모리할당 (Static memory allocation) 일반적으로프로그램의실행에필요한메모리 ( 변수, 배열, 객체등 ) 는컴파일과정에서결정되고, 실행파일이메모리에로드될때할당되며, 종료후에반환됨 동적메모리할당 (Dynamic memory allocation) 프로그램의실행중에필요한메모리를할당받아사용하고, 사용이끝나면반환함 - 메모리를프로그램이직접관리해야함

More information