(Microsoft PowerPoint - hci2-lecture12 [\310\243\310\257 \270\360\265\345])

Size: px
Start display at page:

Download "(Microsoft PowerPoint - hci2-lecture12 [\310\243\310\257 \270\360\265\345])"

Transcription

1 Serialization C# Serialization 년가을학기 11/27/2015 박경신 Serializaiton( 직렬화 ) 란객체상태를지속시키거나전송할수있는형식으로변환하는과정으로, Serialization 반대로다시객체로변환하는것을 Deserialization 임 Serialization 을사용하는이유 객체의상태를저장소에보존했다가나중에똑같은복사본을다시만들기위하거나, 한응용프로그램에서다른응용프로그램으로객체를전송하기위해서임 닷넷에서제공하는 Serialization 방식 Binary Serialization 형식 (Type) 정확도를유지하므로응용프로그램의여러호출간에객체상태를유지하는데유용. 객체를스트림, 디스크, 메모리, 네트워크등으로 serialize 함. XML Serialization public 속성과필드만 serialize 하며형식정확도를유지하지않음. XML 은공개표준이므로웹을통해데이터를공유하는데효과적인방법임. Serialization Binary Serialization Serialize 하고자하는객체의 public, private 필드와클래스이름을모두바이트의스트림 (binary) 로변환하는방식이며, deserialize 되면원본객체의정확한복제본이생성 Binary Serialization 방법 기본 Serialization 클래스의일부멤버를 Serialize 하는선택적 Serialization ISerializable 인터페이스를사용한사용자지정 Serialization XML/SOAP Serialization XML Serialization 은객체의 public 필드와속성또는메소드의매개변수와반환값을 XML 스트림으로 Serialize 하는방식으로, XML Serialization 을사용하면저장이나전송을위해직렬형식으로변환되는 public 속성및필드가있는강력한형식클래스생성 XML/SOAP Serialization 방법 XML Serialization SOAP 인코딩된 XML 스트림으로 Serialization 기본 Serialization 클래스를 Serializable 특성으로표시 public class MyObject { public int n1 = 0; public int n2 = 0; public string str = null; 클래스객체를 Serialize 하여파일로저장 MyObject obj = new MyObject(); // 객체생성 obj.n1 = 1; obj.n2 = 2; obj.str = test ; FileStream stream = new FileStream( TestFile.bin, FileMode.Create, FileAccess.Write, FileShare.None); // FileStream 생성 BinaryFormatter bf= new BinaryFormatter(); // BinaryFormatter 생성 bf.serialze(stream, obj); // Formatter에게 stream과객체를주고 serialize stream.close(); // FileStream 닫기 Serialize 된객체를반대로 Deserialize 로복원 BinaryFormatter bf= new BinaryFormatter(); // BinaryFormatter 생성 FileStream stream = new FileStream( TestFile.bin, FileMode.Open, FileAccess.Read); MyObject obj = (MyObject) bf.deserialze(stream); // Deserialize stream.close(); // FileStream 닫기

2 get { return name; set { name = value; LPersonBinaryFormatter, Version= , Culture=neutral, PublicKeyToken =null Person BinaryFormatter.Person nameidphone address 뺢꼍? 졆 ?17 using System.Runtime.Serialization.Formatters.Binary; FileStream fs = new FileStream(@ C:\Person.bin, FileMode.Create, BinaryFormatter bf= new BinaryFormatter(); bf.serialze(fs, p); // Formatter 에게 stream 과 Person 객체를주고 serialize get { return name; set { name = value; using System.Runtime.Serialization.Formatters.Soap; FileStream fs = new FileStream(@ C:\Person.xml, FileMode.Create, SoapFormatter sf= new SoapFormatter(); sf.serialze(fs, p); // SoapFormatter 에게 stream 과 Person 객체를주고 serialize <SOAP-ENV:Envelope xmlns:xsd=" xmlns:soap- ENC=" xmlns:soap- ENV=" xmlns:clr=" " SOAP- ENV:encodingStyle=" g/"> <SOAP-ENV:Body> <a1:person id="ref-1" xmlns:a1=" apformatter/personsoapformatter%2c%20version%3d % 2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull"> <name id="ref-3"> 박경신 </name> <id>1207</id> <phone id="ref-4"> </phone> <address id="ref-5">3 과 417</address> </a1:person> </SOAP-ENV:Body> </SOAP-ENV:Envelope> using System.Runtime.Serialization.Formatters.Binary; List<Person> plist = new List<Person>(); FileStream fs = new FileStream(@ C:\PersonList.bin, FileMode.Create, BinaryFormatter bf= new BinaryFormatter(); bf.serialze(fs, plist); // BinaryFormatter 에게 stream 과 Person 리스트객체를주고 serialize private void button2_click(object sender, EventArgs e) { FileStream fs = new FileStream(@ C:\PersonList.bin, FileMode.Open, FileAccess.Read); BinaryFormatter bf= new BinaryFormatter(); plist = (List<Person>)bf.Deserialze(fs); // Person 리스트 deserialize // 리스트뷰에출력 listview1.items.clear(); foreach (Person p in plist) { listview1.items.add(p.tolistviewitem());

3 PPersonListBinaryFormatter, Version= , Culture=neutral, PublicKeyToken=null?System.Collections.Generic.List`1[[ PersonListBinaryFormatter.Person, PersonListBinaryFormatter, Version= , Culture=neutral, PublicKeyToken=null]] _items_size_version "PersonListBinaryFormatter.Person[] PersonListBinaryFormatter.Person PersonListBinaryFormatter.Person nameidphone address 뺢꼍? 졆 ?17 고씎 ?15 뺤젙? 쑔 ?15 선택적 Serialization 클래스에서 serialize 하지않아야할필드를 NonSerialized 특성으로표시함으로써해당변수가 Serialize 되지않게함 public class MyObject { public int n1 = 0; [NonSerialized] public int n2 = 0; // n2 멤버는더이상 serialize 되지않음 public string str = null; <SOAP-ENV:Envelope xmlns:xsd=" xmlns:soap- ENC=" xmlns:soap- ENV=" xmlns:clr=" " SOAP- ENV:encodingStyle=" g/"> <SOAP-ENV:Body> <a1:person id="ref-1" xmlns:a1=" apformatter/personsoapformatter%2c%20version%3d % 2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull"> <name id="ref-3"> 박경신 </name> <phone id="ref-4"> </phone> <address id="ref-5">3 과 417</address> </a1:person> </SOAP-ENV:Body> </SOAP-ENV:Envelope> public class Person { [NonSerialized] // 중간생략 Custom Serialization ISerializable 인터페이스를사용한사용자지정 Serialization // GetObjectData 메소드와 deserialize 될때사용되는특수생성자구현이포함되어야함 public class MyObject : ISerializable { public int n1=0; public int n2=0; public string str=null; public MyObject() { protected MyObject(SerializationInfo info, StreamingContext context) { n1 = info.getint32( i ); n2 = info.getint32( j ); str = info.getstring( k ); // deserialize 시필요 [SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter = true)] public virtual void GetObjectData(SerializationInfo info, StreamingContext context){ info.addvalue( i, n1); info.addvalue( j, n2); info.addvalue( k, str); // serialize 시필요

4 public class Person: IComparable<Person>, IEquatable<Person>, ISerializable { <?xml version="1.0"?> <Person xmlns:xsi=" xmlns:xsd=" <Name> 박경신 </Name> <ID>1207</ID> <Phone> </Phone> <Address>3 과 417</Address> #region ISerializable public Person(SerializationInfo info, StreamingContext context) { this.name = info.getstring("name"); this.id = info.getint32("id"); this.phone = info.getstring("phone"); this.address = info.getstring("address"); public void GetObjectData(SerializationInfo info, StreamingContext context) { info.addvalue("name", this.name); info.addvalue("id", this.id); info.addvalue("phone", this.phone); info.addvalue("address", this.address); #endregion Custom Serialization 사용자가 Serialization 을직접제어하는방식으로 ISerializable 인터페이스를사용하는방식외에, Serialization 도중과이후에데이터를수정하는데사용되는메소드에다음특성을적용 OnDeserializedAttribute OnDeserializing Attribute OnSerializedAttribute OnSerializingAttribute XML Serialization XML Serialization 특징 XML 은공개표준이기때문에 XML 스트림은플랫폼에관계없이필요에따라모든응용프로그램에서처리될수있음 XML serialization 은 SOAP 사양과일치하는 XML 스트림으로객체를 serialize 하는데사용할수있음 객체를 serialize 하거나 deserialize 하기위해서는 XmlSerializer 클래스를사용 Serialize 된데이터에는데이터자체와클래스의구조만포함 Public 속성및필드만 serialize 될수있음 만약 public 이아닌데이터를 serialize 해야하는경우 binary serialization 을사용할것 클래스는 XmlSerializer 에의해 serialize 될기본생성자가있어야함 메소드는 serialize 될수없음 XML Serialization XmlSerializer 를사용하여 serialize/deserialize 하는방법 public class MyObject { public int n1=0; private int n2=0; public string str=null; public MyObject() { n1 = 1; n2 =2; str= XML serialization ; // 결과물인 obj.xml 에는 private 멤버와메소드의정보는기록되지않음 class Program { static void Main(string[] args) { MyObject obj = new MyObject(); // MyObject 객체생성 // XmlSerializer 생성자에 serialize 하고자하는객체의타입을전달하여생성 XmlSerializer xs = new XmlSerializer(typeof(MyObject)); StreamWriter sw = new StreamWriter( obj.xml ); // stream writer 생성 xs.serialize(sw, obj); // XmlSerializer 에게 stream 과객체를전달하여 serialize sw.close(); StreamReader sr = new StreamReader( obj.xml ); // stream reader 생성 MyObject obj2 = (MyObject) xs.deserialize(sr); // deserialize Console.WriteLine( n1= + obj2.n1 + str= + obj2.str); sr.close();

5 SOAP 인코딩된 XML Serialization SOAP 인코딩된 XML Serialize 하기위해서는, 새로운 SoapReflectionImporter 를만들고 serialize 된클래스의형식으로 ImportTypeMapping 메소드를호출하여 XmlTypeMapping 을만든뒤 XmlSerializer 생성자매개변수에전달 class Program { static void Main(string[] args) { MyObject obj = new MyObject(); // MyObject 객체생성 XmlTypeMapping xtm = new SoapReflectionImporter().ImportTypeMapping(typeof(MyObject)); XmlSerializer xs = new XmlSerializer(xtm); StreamWriter sw = new StreamWriter( obj.xml ); // stream writer 생성 xs.serialize(sw, obj); // XmlSerializer에게 stream과객체를전달하여 serialize sw.close(); [XmlAttribute(AttributeName= Name )] get { return name; set { name = value; FileStream fs = new FileStream(@ C:\Person.xml, FileMode.Create, XmlSerializer xs= new XmlSerializer(typeof(Person)); xs.serialze(fs, p); // XmlSerializer 에게 stream 과 Person 객체를주고 serialize [XmlAttribute(AttributeName= Name )] get { return name; set { name = value; FileStream fs = new FileStream(@ C:\Person.xml, FileMode.Create, XmlTypeMapping xtm= new SoapReflectionImporter().ImportTypeMapping(typeof(Person)); XmlSerializer xs= new XmlSerializer(xtm); xs.serialze(fs, p); // XmlSerializer에게 stream과 Person 객체를주고 serialize [XmlAttribute(AttributeName= Name )] get { return name; set { name = value; FileStream fs = new FileStream(@ C:\PersonList.xml, FileMode.Create, XmlSerializer xs= new XmlSerializer(typeof(List<Person>)); xs.serialze(fs, plist); // XmlSerializer 에게 stream 과 Person 리스트객체를주고 serialize

6 <?xml version="1.0"?> - <ArrayOfPerson xmlns:xsd=" <Person Name=" 박경신 " ID="1207" Phone=" " Address="3과417" /> <Person Name=" 조흥목 " ID="1204" Phone=" " Address="2과315" /> <Person Name=" 박정서 " ID="1203" Phone=" " Address="2과315" /> </ArrayOfPerson> [XmlElement( Name )] get { return name; set { name = value; FileStream fs = new FileStream(@ C:\PersonList2.xml, FileMode.Create, XmlSerializer xs= new XmlSerializer(typeof(List<Person>)); xs.serialze(fs, plist); // XmlSerializer 에게 stream 과 Person 리스트객체를주고 serialize <?xml version="1.0"?> - <ArrayOfPerson xmlns:xsd=" - <Person> <Name xmlns="urn:person"> 박경신 </Name> <ID xmlns="urn:person">1207</id> <Phone xmlns="urn:person"> </phone> <Address xmlns="urn:person">3 과 417</Address> - <Person> <Name xmlns="urn:person"> 조흥목 </Name> <ID xmlns="urn:person">1204</id> <Phone xmlns="urn:person"> </phone> <Address xmlns="urn:person">2 과 315</Address> - <Person> <Name xmlns="urn:person"> 박정서 </Name> <ID xmlns="urn:person">1203</id> <Phone xmlns="urn:person"> </phone> <Address xmlns="urn:person">2 과 315</Address> </ArrayOfPerson> Serialize multiple objects into the same stream 1 개의스트림안에서여러개의클래스객체를 serialize Person person = new Person(textBox1.Text, int.parse(textbox2.text), int x = int.parse(combobox1.items[combobox1.selectedindex].tostring()); int y = int.parse(combobox2.items[combobox2.selectedindex].tostring()); Point point = new Point(x,y); WeatherInfo weather = new WeatherInfo(double.Parse(textBox5.Text), double.parse(textbox6.text), double.parse(textbox7.text)); FileStream fs = new FileStream(@"C:\MultipleObjects.bin", FileMode.Create, BinaryFormatter formatter = new BinaryFormatter(); // serialize multiple objects into the stream formatter.serialize(fs, person); formatter.serialize(fs, point); formatter.serialize(fs, weather);

7 Serialize multiple objects into the same stream 1 개의스트림안에서여러개의클래스객체를 deserialize private void button2_click(object sender, EventArgs e) { FileStream fs = new FileStream(@"C:\MultipleObjects.bin", FileMode.Open, FileAccess.Read); BinaryFormatter formatter = new BinaryFormatter(); Person person = (Person)formatter.Deserialize(fs); Point point = (Point)formatter.Deserialize(fs); WeatherInfo weather = (WeatherInfo)formatter.Deserialize(fs); textbox1.text = person.name.tostring(); textbox2.text = person.id.tostring(); textbox3.text = person.phone.tostring(); textbox4.text = person.address.tostring(); combobox1.text = point.x.tostring(); combobox2.text = point.y.tostring(); textbox5.text = weather.temperature.tostring(); textbox6.text = weather.wind.tostring(); textbox7.text = weather.humidity.tostring(); Create a new XML file using XmlDocument FileStream stream = File.Open(FileName, FileMode.OpenOrCreate); XmlDocument xmldoc = new XmlDocument(); XmlNode nodepersonlist = xmldoc.createnode("element", "PersonList", ""); foreach (Person p in plist) { XmlNode nodeperson = xmldoc.createnode("element", "Person", ""); XmlNode nodename = xmldoc.createnode("element", "Name", ""); nodename.innertext = Convert.ToString(p.Name); XmlNode nodeid = xmldoc.createnode("element", "ID", ""); nodeid.innertext = Convert.ToString(p.ID); XmlNode nodephone = xmldoc.createnode("element", "Phone", ""); nodephone.innertext = Convert.ToString(p.Phone); XmlNode nodeaddress = xmldoc.createnode("element", "Address", ""); nodeaddress.innertext = Convert.ToString(p.Address); nodeperson.appendchild(nodename); nodeperson.appendchild(nodeid); nodeperson.appendchild(nodephone); nodeperson.appendchild(nodeaddress); nodepersonlist.appendchild(nodeperson); xmldoc.appendchild(nodepersonlist); xmldoc.save(stream); stream.close(); Load a XML file using XmlDocument FileStream stream = File.Open(FileName, FileMode.OpenOrCreate, FileAccess.Read); XmlDocument xmldoc = new XmlDocument(); xmldoc.load(stream); XmlNode nodepersonlist; nodepersonlist = xmldoc.firstchild; foreach (XmlNode nodeperson in nodepersonlist) { Person p = new Person(); p.name = nodeperson.firstchild.innertext; p.id = Int32.Parse(nodePerson.FirstChild.NextSibling.InnerText); p.phone = nodeperson.firstchild.nextsibling.nextsibling.innertext; p.address = nodeperson.lastchild.innertext; plist.add(p); stream.close();

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

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

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

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

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

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 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

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 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

(Microsoft PowerPoint - C#\260\355\261\3361.ppt)

(Microsoft PowerPoint - C#\260\355\261\3361.ppt) - 1 - C# Programming 고급 이현정 hjyi@hotmail.com MCT/MCSD/MCAD/MCSD.NET 교재목차 - 2-1부 C# 언어 1장 C, C++ 그리고 C# 2장 Hello, C#! 3장변수와자료형 4장연산자 5장흐름제어 6장메쏘드 7장클래스 8장배열과컬렉션 9장속성과인덱서 10장델리게이트와이벤트 11장예외처리 12장특성 13장일반화프로그래밍

More information

<4D F736F F F696E74202D20C1A63038C0E520C5ACB7A1BDBABFCD20B0B4C3BC4928B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

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

More information

Microsoft PowerPoint - CSharp-10-예외처리

Microsoft PowerPoint - CSharp-10-예외처리 10 장. 예외처리 예외처리개념 예외처리구문 사용자정의예외클래스와예외전파 순천향대학교컴퓨터학부이상정 1 예외처리개념 순천향대학교컴퓨터학부이상정 2 예외처리 오류 컴파일타임오류 (Compile-Time Error) 구문오류이기때문에컴파일러의구문오류메시지에의해쉽게교정 런타임오류 (Run-Time Error) 디버깅의절차를거치지않으면잡기어려운심각한오류 시스템에심각한문제를줄수도있다.

More information

3ÆÄÆ®-14

3ÆÄÆ®-14 chapter 14 HTTP >>> 535 Part 3 _ 1 L i Sting using System; using System.Net; using System.Text; class DownloadDataTest public static void Main (string[] argv) WebClient wc = new WebClient(); byte[] response

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Lab 4 ADT Design 클래스로정의됨. 모든객체들은힙영역에할당됨. 캡슐화 (Encapsulation) : Data representation + Operation 정보은닉 (Information Hiding) : Opertion부분은가려져있고, 사용자가 operation으로만사용가능해야함. 클래스정의의형태 public class Person { private

More information

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

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

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

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

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

어댑터뷰

어댑터뷰 04 커스텀어댑터뷰 (Custom Adapter View) 커스텀어댑터뷰 (Custom Adapter View) 커스텀어댑터뷰 (Custom Adatper View) 란? u 어댑터뷰의항목하나는단순한문자열이나이미지뿐만아니라, 임의의뷰가될수 있음 이미지뷰 u 커스텀어댑터뷰설정절차 1 2 항목을위한 XML 레이아웃정의 어댑터정의 3 어댑터를생성하고어댑터뷰객체에연결

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

비긴쿡-자바 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 자바프로그래밍 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

예제 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

JAVA PROGRAMMING 실습 02. 표준 입출력

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

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

쉽게 풀어쓴 C 프로그래밍

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

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

@OneToOne(cascade = = "addr_id") private Addr addr; public Emp(String ename, Addr addr) { this.ename = ename; this.a

@OneToOne(cascade = = addr_id) private Addr addr; public Emp(String ename, Addr addr) { this.ename = ename; this.a 1 대 1 단방향, 주테이블에외래키실습 http://ojcedu.com, http://ojc.asia STS -> Spring Stater Project name : onetoone-1 SQL : JPA, MySQL 선택 http://ojc.asia/bbs/board.php?bo_table=lecspring&wr_id=524 ( 마리아 DB 설치는위 URL

More information

쉽게 풀어쓴 C 프로그래밍

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

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

PowerPoint 프레젠테이션

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

More information

Microsoft PowerPoint - C++ 5 .pptx

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

More information

PowerPoint Presentation

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

More information

(Microsoft PowerPoint - java1-lecture11.ppt [\310\243\310\257 \270\360\265\345])

(Microsoft PowerPoint - java1-lecture11.ppt [\310\243\310\257 \270\360\265\345]) 예외와예외클래스 예외처리 514760-1 2016 년가을학기 12/08/2016 박경신 오류의종류 에러 (Error) 하드웨어의잘못된동작또는고장으로인한오류 에러가발생되면 JVM실행에문제가있으므로프로그램종료 정상실행상태로돌아갈수없음 예외 (Exception) 사용자의잘못된조작또는개발자의잘못된코딩으로인한오류 예외가발생되면프로그램종료 예외처리 추가하면정상실행상태로돌아갈수있음

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

<4D F736F F D20BEBEBCA520C4DAB5F920BFACBDC0202D20B8D6C6BC20BEB2B7B9B5E5BFCD20C0CCBAA5C6AE2E646F6378>

<4D F736F F D20BEBEBCA520C4DAB5F920BFACBDC0202D20B8D6C6BC20BEB2B7B9B5E5BFCD20C0CCBAA5C6AE2E646F6378> C# 코딩연습 멀티쓰레드와이벤트 2009-05-18 김태현 (kimgwajang@hotmail.com) I. 서 제블로그 1 의카테고리중에.NET Tip of The Day' 라는것이있는데, 동명의사이트 2 에실린유용한닷넷팁들을번역하여소개하는포스팅이모여있습니다. 이중 Correct event invocation 3 라는제목의포스트가있는데, 멀티쓰레드환경에서이벤트를호출하는올바른방법에관해서설명을하고있습니다.

More information

<4D F736F F F696E74202D20C1A63234C0E520C0D4C3E2B7C228B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20C1A63234C0E520C0D4C3E2B7C228B0ADC0C729205BC8A3C8AF20B8F0B5E55D> Power Java 제 24 장입출력 이번장에서학습할내용 스트림이란? 스트림의분류 바이트스트림 문자스트림 형식입출력 명령어행에서입출력 파일입출력 스트림을이용한입출력에대하여살펴봅시다. 스트림 (stream) 스트림 (stream) 은 순서가있는데이터의연속적인흐름 이다. 스트림은입출력을물의흐름처럼간주하는것이다. 스트림들은연결될수있다. 중간점검문제 1. 자바에서는입출력을무엇이라고추상화하는가?

More information

JAVA PROGRAMMING 실습 07. 상속

JAVA PROGRAMMING 실습 07. 상속 상속 부모클래스에정의된필드와메소드를자식클래스가물려받는것 슈퍼클래스 (superclass) 특성을물려주는상위클래스 서브클래스 (subclass) 특성을물려받는하위클래스 슈퍼클래스에자신만의특성 ( 필드, 메소드 ) 추가 슈퍼클래스의특성 ( 메소드 ) 을수정 = 오버라이딩구체화 class Phone 전화걸기전화받기 class MobilePhone 전화걸기전화받기무선기지국연결배터리충전하기

More information

Microsoft PowerPoint - 2강

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

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

C++ Programming

C++ Programming C++ Programming 상속과다형성 Seo, Doo-okok clickseo@gmail.com http://www.clickseo.com 목 차 상속의이해 상속과다형성 다중상속 2 상속과다형성 객체의이해 상속클래스의객체의생성및소멸 상속의조건 상속과다형성 다중상속 3 상속의이해 상속 (Inheritance) 클래스에구현된모든특성 ( 멤버변수와멤버함수 )

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 - Chapter 6.ppt

Microsoft PowerPoint - Chapter 6.ppt 6.Static 멤버와 const 멤버 클래스와 const 클래스와 static 연결리스트프로그램예 Jong Hyuk Park 클래스와 const Jong Hyuk Park C 의 const (1) const double PI=3.14; PI=3.1415; // 컴파일오류 const int val; val=20; // 컴파일오류 3 C 의 const (1)

More information

17장 클래스와 메소드

17장 클래스와 메소드 17 장클래스와메소드 박창이 서울시립대학교통계학과 박창이 ( 서울시립대학교통계학과 ) 17 장클래스와메소드 1 / 18 학습내용 객체지향특징들객체출력 init 메소드 str 메소드연산자재정의타입기반의버전다형성 (polymorphism) 박창이 ( 서울시립대학교통계학과 ) 17 장클래스와메소드 2 / 18 객체지향특징들 객체지향프로그래밍의특징 프로그램은객체와함수정의로구성되며대부분의계산은객체에대한연산으로표현됨객체의정의는

More information

rmi_박준용_final.PDF

rmi_박준용_final.PDF (RMI) - JSTORM http://wwwjstormpekr (RMI)- Document title: Document file name: Revision number: Issued by: Document Information (RMI)- rmi finaldoc Issue Date: Status:

More information

쉽게 풀어쓴 C 프로그래밍

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

More information

5장.key

5장.key JAVA Programming 1 (inheritance) 2!,!! 4 3 4!!!! 5 public class Person {... public class Student extends Person { // Person Student... public class StudentWorker extends Student { // Student StudentWorker...!

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 상속 배효철 th1g@nate.com 1 목차 상속개념 클래스상속 부모생성자호출 메소드재정의 final 클래스와 final 메소드 protected 접근제한자 타입변환과다형성 추상클래스 2 상속개념 상속 (Inheritance) 이란? 현실세계 : 부모가자식에게물려주는행위 부모가자식을선택해서물려줌 객체지향프로그램 : 자식 ( 하위, 파생 ) 클래스가부모 (

More information

JVM 메모리구조

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

More information

Spring Data JPA Many To Many 양방향 관계 예제

Spring Data JPA Many To Many 양방향 관계 예제 Spring Data JPA Many To Many 양방향관계예제 오라클자바커뮤니티 (ojc.asia, ojcedu.com) 엔티티매핑 (Entity Mapping) M : N 연관관계 사원 (Sawon), 취미 (Hobby) 는다 : 다관계이다. 사원은여러취미를가질수있고, 하나의취미역시여러사원에할당될수있기때문이다. 보통관계형 DB 에서는다 : 다관계는 1

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

교육자료

교육자료 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

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++ 프로그래밍 jhhwang@kumoh.ac.kr 컴퓨터공학과 황준하 9 강. 클래스의활용목차 멤버함수의외부정의 this 포인터 friend 선언 static 멤버 임시객체 1 /17 9 강. 클래스의활용멤버함수의외부정의 멤버함수정의구현방법 내부정의 : 클래스선언내에함수정의구현 외부정의 클래스선언 : 함수프로토타입 멤버함수정의 : 클래스선언외부에구현

More information

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

Microsoft PowerPoint - additional08.ppt [호환 모드] 8. 상속과다형성 (polymorphism) 상속된객체와포인터 / 참조자의관계 정적바인딩과동적바인딩 virtual 소멸자 Jong Hyuk Park 상속의조건 public 상속은 is-a 관계가성립되도록하자. 일반화 ParttimeStd 구체화 2 상속의조건 잘못된상속의예 현실세계와완전히동떨어진모델이형성됨 3 상속의조건 HAS-A( 소유 ) 관계에의한상속!

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 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

쉽게 풀어쓴 C 프로그래밍

쉽게 풀어쓴 C 프로그래밍 제 5 장생성자와접근제어 1. 객체지향기법을이해한다. 2. 클래스를작성할수있다. 3. 클래스에서객체를생성할수있다. 4. 생성자를이용하여객체를초기화할수 있다. 5. 접근자와설정자를사용할수있다. 이번장에서만들어볼프로그램 생성자 생성자 (constructor) 는초기화를담당하는함수 생성자가필요한이유 #include using namespace

More information

Network Programming

Network Programming Part 5 확장된 Network Programming 기술 1. Remote Procedure Call 2. Remote Method Invocation 3. Object Request Broker 2. Java RMI

More information

Microsoft PowerPoint - Chap12-OOP.ppt

Microsoft PowerPoint - Chap12-OOP.ppt 객체지향프로그래밍 (Object Oriented Programming) 12 장강사 강대기 차례 (Agenda) 멤버에대한동적메모리할당 암시적 / 명시적복사생성자 암시적 / 명시적오버로딩대입연산자 생성자에 new 사용하기 static 클래스멤버 객체에위치지정 new 사용하기 객체를지시하는포인터 StringBad 클래스 멤버에포인터사용 str static 멤버

More information

C++ Programming

C++ Programming C++ Programming 연산자다중정의 Seo, Doo-okok clickseo@gmail.com http://www.clickseo.com 목 차 연산자다중정의 C++ 스타일의문자열 2 연산자다중정의 연산자다중정의 단항연산자다중정의 이항연산자다중정의 cin, cout 그리고 endl C++ 스타일의문자열 3 연산자다중정의 연산자다중정의 (Operator

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

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

(Microsoft PowerPoint - 07\300\345.ppt [\310\243\310\257 \270\360\265\345])

(Microsoft PowerPoint - 07\300\345.ppt [\310\243\310\257 \270\360\265\345]) 클래스의응용 클래스를자유자재로사용하자. 이장에서다룰내용 1 객체의치환 2 함수와클래스의상관관계 01_ 객체의치환 객체도변수와마찬가지로치환이가능하다. 기본예제 [7-1] 객체도일반변수와마찬가지로대입이가능하다. 기본예제 [7-2] 객체의치환시에는조심해야할점이있다. 복사생성자의필요성에대하여알아보자. [ 기본예제 7-1] 클래스의치환 01 #include

More information

쉽게 풀어쓴 C 프로그래밊

쉽게 풀어쓴 C 프로그래밊 Power Java 제 27 장데이터베이스 프로그래밍 이번장에서학습할내용 자바와데이터베이스 데이터베이스의기초 SQL JDBC 를이용한프로그래밍 변경가능한결과집합 자바를통하여데이터베이스를사용하는방법을학습합니다. 자바와데이터베이스 JDBC(Java Database Connectivity) 는자바 API 의하나로서데이터베이스에연결하여서데이터베이스안의데이터에대하여검색하고데이터를변경할수있게한다.

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

JAVA PROGRAMMING 실습 09. 예외처리

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

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 @ Lesson 3 if, if else, if else if, switch case for, while, do while break, continue : System.in, args, JOptionPane for (,, ) @ vs. logic data method variable Data Data Flow (Type), ( ) @ Member field

More information

05-class.key

05-class.key 5 : 2 (method) (public) (private) (interface) 5.1 (Method), (public method) (private method) (constructor), 3 4 5.2 (client). (receiver)., System.out.println("Hello"); (client object) (receiver object)

More information

Interstage5 SOAP서비스 설정 가이드

Interstage5 SOAP서비스 설정 가이드 Interstage 5 Application Server ( Solaris ) SOAP Service Internet Sample Test SOAP Server Application SOAP Client Application CORBA/SOAP Server Gateway CORBA/SOAP Gateway Client INTERSTAGE SOAP Service

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 클래스 배효철 th1g@nate.com 1 목차 객체지향프로그래밍 객체지향프로그래밍의특징 객체와클래스 클래스 클래스의구성 클래스의선언및객체생성 필드 생성자 메소드 2 목차 객체지향프로그래밍 객체지향프로그래밍의특징 객체와클래스 클래스 클래스의구성 클래스의선언및객체생성 필드 생성자 메소드 3 객체지향프로그래밍 객체지향프로그래밍이란? OOP ( Object Oriented

More information

제8장 자바 GUI 프로그래밍 II

제8장 자바 GUI 프로그래밍 II 제8장 MVC Model 8.1 MVC 모델 (1/7) MVC (Model, View, Controller) 모델 스윙은 MVC 모델에기초를두고있다. MVC란 Xerox의연구소에서 Smalltalk 언어를바탕으로사용자인터페이스를개발하기위한방법 MVC는 3개의구성요소로구성 Model : 응용프로그램의자료를표현하기위한모델 View : 자료를시각적으로 (GUI 방식으로

More information

3ÆÄÆ®-11

3ÆÄÆ®-11 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 Chapter 17 C # N e t w o r k P r o g r a m m i n g Part 3 _ chapter 11 ICMP >>> 430 Chapter 11 _ 1 431 Part 3 _ 432 Chapter 11 _ N o t

More information

슬라이드 1

슬라이드 1 4 장클래스다이어그램 구성요소 객체와클래스 클래스추출 한빛미디어 ( 주 ) 학습목표 클래스의개념과구성요소를이해한다. 클래스추출과관계를학습한다. 관계를코드로이해한다. 2 학습목표 클래스의구성요소 클래스이름 (class name) 공통의속성, 메서드 ( 오퍼레이션 ), 관계, 의미를공유하는객체들의집합에대한기술이다. 속성 (attributes) 클래스의구조적특성에이름을붙인것으로구조적특성에해당하는인스턴스가보유할수있는값의범위를기술한다.

More information

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

Microsoft PowerPoint - additional06.ppt [호환 모드] 보조자료 6.Static 멤버와 const 멤버 클래스와 const 클래스와 static 연결리스트프로그램예 Jong Hyuk Park 클래스와 const Jong Hyuk Park 복습 : Const 키워드왜사용? C 의 const (1) const double PI=3.14; PI=3.1415; // 컴파일오류 const int val; val=20; //

More information

슬라이드 1

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

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 예외처리 배효철 th1g@nate.com 1 목차 예외와예외클래스 실행예외 예외처리코드 예외종류에따른처리코드 자동리소스닫기 예외처리떠넘기기 사용자정의예외와예외발생 예외와예외클래스 구문오류 예외와예외클래스 구문오류가없는데실행시오류가발생하는경우 예외와예외클래스 import java.util.scanner; public class ExceptionExample1

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

(Microsoft PowerPoint - java2-lecture3.ppt [\310\243\310\257 \270\360\265\345])

(Microsoft PowerPoint - java2-lecture3.ppt [\310\243\310\257 \270\360\265\345]) Class Class, Collections 514770-1 2017 년봄학기 3/22/2017 박경신 클래스 (Class) 객체의속성과행위선언 객체의설계도혹은틀 객체 (Object) 클래스의틀로찍어낸실체 메모리공간을갖는구체적인실체 클래스를구체화한객체를인스턴스 (instance) 라고부름 객체와인스턴스는같은뜻으로사용 클래스구조 클래스접근권한, public 다른클래스들에서이클래스를사용하거나접근할수있음을선언

More information

안드로이드기본 11 차시어댑터뷰 1 학습목표 어댑터뷰가무엇인지알수있다. 리스트뷰와스피너를사용하여데이터를출력할수있다. 2 확인해볼까? 3 어댑터뷰 1) 학습하기 어댑터뷰 - 1 -

안드로이드기본 11 차시어댑터뷰 1 학습목표 어댑터뷰가무엇인지알수있다. 리스트뷰와스피너를사용하여데이터를출력할수있다. 2 확인해볼까? 3 어댑터뷰 1) 학습하기 어댑터뷰 - 1 - 11 차시어댑터뷰 1 학습목표 어댑터뷰가무엇인지알수있다. 리스트뷰와스피너를사용하여데이터를출력할수있다. 2 확인해볼까? 3 어댑터뷰 1) 학습하기 어댑터뷰 - 1 - ArrayAdapter ArrayAdapter adapter = new ArrayAdapter(this, android.r.layout.simple_list_item_1,

More information

No Slide Title

No Slide Title 상속 이충기 명지대학교컴퓨터공학과 상속 Q: 건설회사는기존아파트와조금다르거나추가적인특징들을가진새아파트를지을때어떻게하는가? A: 2 상속 상속 (inheritance) 은클래스들을연관시키는자연스럽고계층적인방법이다. 상속은객체지향프로그래밍의가장중요한개념중의하나이다. 상속은 은 이다 라는관계 (is-a relationship) 를나타낸다. 이관계를적용하여클래스들을상하관계로연결하는것이상속이다.

More information

Microsoft PowerPoint 장강의노트.ppt

Microsoft PowerPoint 장강의노트.ppt 클래스와객체 클래스와객체 객체 : 우리주변의어떤대상의모델 - 예 : 사람, 차, TV, 개 객체 = 상태 (state) + 행동 (behavior) - 예 : 개의상태 - 종자, 이름, 색개의행동 - 짖다, 가져오다 상태는변수로행동은메소드로나타냄 객체는클래스에의해정의된다. 클래스는객체가생성되는틀혹은청사진이다. 2 예 : 클래스와객체 질문 : 클래스와객체의다른예는?

More information

C++ Programming

C++ Programming C++ Programming 클래스와데이터추상화 Seo, Doo-okok clickseo@gmail.com http://www.clickseo.com 목 차 객체지향프로그래밍 클래스와객체 2 객체지향프로그래밍 객체지향언어 (Object-Oriented Language) 프로그램을명령어의목록으로보는시각에서벗어나여러개의 독립된단위, 즉 객체 (Object) 들의모임으로파악

More information

1. auto_ptr 다음프로그램의문제점은무엇인가? void func(void) int *p = new int; cout << " 양수입력 : "; cin >> *p; if (*p <= 0) cout << " 양수를입력해야합니다 " << endl; return; 동적할

1. auto_ptr 다음프로그램의문제점은무엇인가? void func(void) int *p = new int; cout <<  양수입력 : ; cin >> *p; if (*p <= 0) cout <<  양수를입력해야합니다  << endl; return; 동적할 15 장기타주제들 auto_ptr 변환함수 cast 연산자에의한명시적형변환실행시간타입정보알아내기 (RTTI) C++ 프로그래밍입문 1. auto_ptr 다음프로그램의문제점은무엇인가? void func(void) int *p = new int; cout > *p; if (*p

More information

Microsoft Word - EEL2 Lab4.docx

Microsoft Word - EEL2 Lab4.docx EEL2 LAB Week 4: Inheritance 1. 다음을만족하는클래스 Employee를작성하시오.(1에서 4번까지관련된문제입니다.) 클래스 Employee 직원는클래스 Regular 정규직와 Temporary 비정규직의상위클래스 필드 : 이름, 나이, 주소, 부서, 월급정보를필드로선언 생성자 : 이름, 나이, 주소, 부서를지정하는생성자정의 메소드 printinfo():

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

Analytics > Log & Crash Search > Unity ios SDK [Deprecated] Log & Crash Unity ios SDK. TOAST SDK. Log & Crash Unity SDK Log & Crash Search. Log & Cras

Analytics > Log & Crash Search > Unity ios SDK [Deprecated] Log & Crash Unity ios SDK. TOAST SDK. Log & Crash Unity SDK Log & Crash Search. Log & Cras Analytics > Log & Crash Search > Unity ios SDK [Deprecated] Log & Crash Unity ios SDK. TOAST SDK. Log & Crash Unity SDK Log & Crash Search. Log & Crash Unity SDK... Log & Crash Search. - Unity3D v4.0 ios

More information

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

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

More information

I T C o t e n s P r o v i d e r h t t p : / / w w w. h a n b i t b o o k. c o. k r

I T C o t e n s P r o v i d e r h t t p : / / w w w. h a n b i t b o o k. c o. k r I T C o t e n s P r o v i d e r h t t p : / / w w w. h a n b i t b o o k. c o. k r I T C o t e n s P r o v i d e r h t t p : / / w w w. h a n b i t b o o k. c o. k r Jakarta is a Project of the Apache

More information

(Microsoft Word - C# \304\332\265\371 \277\254\275\300.docx)

(Microsoft Word - C# \304\332\265\371 \277\254\275\300.docx) C# 코딩연습 대리자와이벤트 2007-12-13 김과장 (kimgwajang@hotmail.com) A. 대리자 사람을나타내는간단한 Person 클래스로부터시작하겠습니다. 01 public class Person 03 private int _age; 04 05 public int Age 06 { 07 get { return _age; } 08 set { _age

More information

슬라이드 1

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

More information

12-file.key

12-file.key 11 (String).. java.lang.stringbuffer. s String s = "abcd"; s = s + "e"; a b c d e a b c d e ,., "910359,, " "910359" " " " " (token) (token),, (delimiter). java.util.stringtokenizer String s = "910359,,

More information

C++ Programming

C++ Programming C++ Programming 예외처리 Seo, Doo-okok clickseo@gmail.com http://www.clickseo.com 목 차 예외처리 2 예외처리 예외처리 C++ 의예외처리 예외클래스와객체 3 예외처리 예외를처리하지않는프로그램 int main() int a, b; cout > a >> b; cout

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

유니티 변수-함수.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

<4D F736F F F696E74202D2036C0CFC2B05FB0B4C3BCC1F6C7E2C7C1B7CEB1D7B7A1B9D62E707074>

<4D F736F F F696E74202D2036C0CFC2B05FB0B4C3BCC1F6C7E2C7C1B7CEB1D7B7A1B9D62E707074> 객체지향프로그램밍 (Object-Oriented Programming) 1 C++ popular C 객체지향 (object oriented) C++ C : 상위계층언어특징 + 어셈블리언어특징 C++ : 소프트웨어개발플랫폼에객체지향개념제공 객체지향 : 자료와이들자료를어떻게다룰것인지따로생각하지않고단지하나의사물로생각 형 변수가사용하는메모리크기 변수가가질수있는정보

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

임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과

임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과 임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과 System call table and linkage v Ref. http://www.ibm.com/developerworks/linux/library/l-system-calls/ - 2 - Young-Jin Kim SYSCALL_DEFINE 함수

More information

슬라이드 1

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

More information

Microsoft PowerPoint - Supplement-03-TCP Programming.ppt [호환 모드]

Microsoft PowerPoint - Supplement-03-TCP Programming.ppt [호환 모드] - Socket Programming in Java - 목차 소켓소개 자바에서의 TCP 프로그램작성방법 주요클래스와메소드 HTTP 프로토콜을이용한예제 에코프로그램 Q/A 에코프로그램 - EchoServer 에코프로그램 - EchoClient TCP Programming 1 소켓소개 IP, Port, and Socket 포트 (Port): 전송계층에서통신을수행하는응용프로그램을찾기위한주소

More information

Spring Boot/JDBC JdbcTemplate/CRUD 예제

Spring Boot/JDBC JdbcTemplate/CRUD 예제 Spring Boot/JDBC JdbcTemplate/CRUD 예제 오라클자바커뮤니티 (ojc.asia, ojcedu.com) Spring Boot, Gradle 과오픈소스인 MariaDB 를이용해서 EMP 테이블을만들고 JdbcTemplate, SimpleJdbcTemplate 을이용하여 CRUD 기능을구현해보자. 마리아 DB 설치는다음 URL 에서확인하자.

More information