월요일, 12월 23
Shadow

미분류

#021 NetBeans GUI Builder

미분류
Lab Exercises Exercise 1: Create ContactEditor GUI using NetBeans GUI Builder (30 minutes) Exercise 2: Add event handlers to GUI components (30 minutes) Homework Exercise (for people who are taking Sang Shin's "Java Programming online course")   Exercise 1: Create ContactEditor GUI using NetBeans GUI Builder   This exercise guides you through the process of creating the graphical user interface (GUI) for an application called ContactEditor using the NetBeans IDE's GUI Builder (also known by the code name Matisse). In the process, you will layout a GUI front-end that enables you to view and edit contact information of individuals included in an employee database. This exercise is based on the GUI Building in NetBeans IDE article written by Talley Mulligan fr...

#021 Java Swing

미분류
Lab Exercises Exercise 1: Learning Swing By Example Homework Exercise (for people who are taking Sang Shin's "Java Intro Programming online course") Exercise 1: Leaning Swing by Example This exercise explains the concepts you need to use Swing components in building a user interface. First we examine the simplest Swing application you can write. Then we present several progressively complicated examples of creating user interfaces using components in the javax.swing package. We cover several Swing components, such as buttons, labels, and text areas. The handling of events is also discussed, as are layout management and accessibility. This lesson ends with a set of questions and exercises so you can test yourself on what you’ve learned. Acknowledgment: The sample applicatio...

#019 Using Java Collection Frameworks

미분류
Lab Exercises Exercise 1: Build and run applications that use "Set" Collection objects (30 minutes) Exercise 2: Build and run applications that use "List" Collection objects (30 minutes) Exercise 3: Build and run applications that use "Map" Collection objects (30 minutes) Exercise 4: Iterator (10 minutes) Exercise 5: Algorithms (30 minutes) Homework Exercise (for people who are taking Sang Shin's "Java Programming online course")   Exercise 1: Build and run "Set" Collection Objects The Set interface extends the Collection interface and, by definition, forbids duplicates within the collection. All the original methods are present and no new methods are introduced. The concrete Set implementation classes rely on the equals() method of the object added to check for e...

#018 Garbage Collection Basics

미분류
모든 Java Application은 JVM(Java Virtual Machine)위에서 동작한다. 이 JVM이 동작하는데 있어서, 메모리의 구조와 특히 GC는 Application의 응답시간과 성능에 밀접한 관계를 미친다. 이번 강좌에서는 JVM 의 메모리 구조와 GC 알고리즘 (JDK 1.4.X에 포함된 새로운 알고리즘 포함) 그리고, JVM의 메모리 튜닝을 통한 Application의 성능향상방법에 대해서 알아보도록 하자. 1.GC란 무엇인가? GC는 Garbage Collection의 약자로 Java 언어의 중요한 특징중의 하나이다. GC는 Java Application에서 사용하지 않는 메모리를 자동으로 수거하는 기능을 말한다. 예 전의 전통적인 언어 C등의 경우 malloc, free등을 이용해서 메모리를 할당하고, 일일이 그 메모리를 수거해줘야했다. 그러나 Java 언어에서는 GC 기술을 사용함에 따라서 개발자로 하여금 메모리 관리에서 부터 좀더 자유롭게 해주었다. 2.GC의 동작 방법은 어떻게 되는가? 1) JVM 메모리 영역 GC의 동작 방법을 이해하기 위해서는 Java의 메모리 구조를 먼저 이해할 필요가 있다. 일반적으로 Application에서 사용되는 객체는 오래 유지 되는 객체보다, 생성되고 얼마안있어서 사용되지 않는 경우가 많다. <그림 1 참조> <그림 1. 메모리 foot print> 그래서 Java에서는 크게 두가지 영역으로 메모리를 나누는데 Young 영역과 Old 영역이 그것이다. Young...

#017 Java Logging

미분류
Lab Exercises Exercise 1: Simple logging (30 minutes) Exercise 2: Log to file and multiple handlers (30 minutes) Homework Exercise (for people who are taking Sang Shin's "Java Programming online course")   Exercise 1: Simple logging In this exercise, you are going to learn how to use Java logging APIs for doing simple logging. Build and run an application that uses simple logging Set logging level (1.1) Build and run an application that uses simple logging 0. Start NetBeans IDE if you have not done so yet. 1. Create a new NetBeans project Select File->New Project (Ctrl+Shift+N). The New Project dialog box appears. Under Choose Project pane, select Java under Categories and Java Application under Projects. Click Next. Under Name and Lo...

#016 Exception Handling

미분류
Lab Exercises Exercise 1: Exception handling (30 minutes) Exercise 2: Custom exceptions (30 minutes) Exercise 3: Assertions (15 minutes) Homework Exercise (for people who are taking Sang Shin's "Java Programming online course")   Exercise 1: Exception Handling In this exercise, you are going to trigger and catch built-in exceptions through try-catch-finally block. Catch a runtime exception - divide a number by zero Catch multiple runtime exceptions Experience various exceptions ArrayIndexOutOfBoundsException Call built-in methods of Exception class (1.1) Catch a runtime exception In this step, you are going to trigger a runtime exception by dividing a number by 0.  First, you will see how the default handler that is provided by the Java runtime sys...

#015 Java Inner Class

미분류
Lab Exercises and homeworks Exercise 1: Build and run Java applications that use inner classes (20 minutes) Homework Exercise (for people who are taking Sang Shin's "Java Programming online course")   Exercise 1: Build and run Java applications that use inner class Build and run a simple application that uses an inner class (1.1) Build and run a simple application that uses an inner class 0. Start the NetBeans IDE if you have not done so. 1. Create a NetBeans project Select File from top-level menu and select New Project. Observe that the New Project dialog box appears. Select General under Categories section and Java Application under Projects section. Click Next. Under Name and Location pane, for the Project Name field, enter InnerClassExample....

#014 Java Polymorphism

미분류
Lab Exercises Exercise 1: Polymorphic behavior via method overriding (30 minutes) Exercise 2: Polymorphic behavior via abstract class (30 minutes) Exercise 3: Polymorphic behavior via Java interface (30 minutes) Homework Exercise (for people who are taking Sang Shin's "Java Programming online course")   Exercise 1: Polymorphic behavior via method overriding In this exercise, you are going build MyOnlineShop project first and then add ChildrenBook and Cartoon subclasses of the Book class. Build and run MyOnlineShop NetBeans project Add ChildrenBook and Cartoon subclasses (1.1) Build and run MyOnlineShop NetBeans project The MyOnlineShop project  is the same project that you have built and run as part of Java Inheritance hands-on lab.  Here we are go...

#013 Java Interface and Abstract Class

미분류
Lab Exercises Exercise 1: Abstract class (30 minutes) Exercise 2: Interface as a Type (30 minutes) Exercise 3: Implementing multiple interfaces (30 minutes) Exercise 4: Interface and polymorphism (20 minutes) Exercise 5: Inheritance among interfaces (30 minutes) Exercise 6: Rewriting an interface (20 minutes) Homework Exercise (for people who are taking Sang Shin's "Java Programming online course")   Exercise 1: Abstract class In this exercise, you will write Java program that use abstract classes.  You will also learn how to add polymorphic behavior to the program through abstact methods. Build and run an application that uses an Abstract class Build MyOnlineShopUsingAbstractClass project (1.1) Build and run an application that uses an Abstract...

#012 Java Inheritance

미분류
  Lab Exercises Exercise 1: Build and run a Java program which uses classes that are related through Inheritance (30 minutes) Exercise 2: Constructor calling chain and super keyword (30 minutes) Exercise 3: Overloading (30 minutes) Exercise 4: Type casting (30 minutes) Exercise 5: Final class and final method (20 minutes) Exercise 6: Build an application (30 minutes) Homework Exercise (for people who are taking Sang Shin's "Java Programming online course")   Exercise 1: Build and run a Java program which uses classes that are related through Inheritance In this exercise, you are going to write a program in which multiple classes, which are related with inheritance, are created and used.  First, you will create Person class.  Then you will create sub-classes ...