월요일, 12월 23
Shadow

미분류

#031 Servlet 3.0

미분류
Java Servlet 3.0 (JSR 315), which is part of Java EE 6, is a major revision of the Java Servlet technology, a widely accepted technology for building dynamic content for web-based applications, and includes changes to enable easy pluggability of popular open-source frameworks or libraries, ease of development leveraging annotation and making web.xml optional, support for async processing, which enables writing Comet applications in portable fashion, security enhancements, and other minor updates to the existing APIs. In this lab, you are going exercise all the newly introduced features of Servlet 3.0. Expected duration: 210 minutes (excluding homework)     Software Needed Before you begin, you need to install JDK 6 and NetBeans IDE 6.8.  You also need to downloa...

#030 Java EE 6 Overrview & Getting Java EE 6 sample codes

미분류
Lab Exercises Exercise 1: Get "glassfish-samples" examples from GlassFish v3 Update center Exercise 2: Get "Java EE 6 tutorial" examples from GlassFish v3 Update center Exercise 3: Check out "glassfish-samples" examples from java.net (Optional) Homework Exercise (for people who are taking Sang Shin's "Java EE Programming online course") Exercise 1: Get "glassfish-samples" examples from GlassFish v3 Update center In this exercise, you are going to get "glassfish-samples" examples from GlassFish v3 update center.  The "glassfish-samples" contains many Java EE 5 and Java EE 6 examples in the form of "ready-to-run" NetBeans projects. Start GlassFish v3 update center Get "Java EE Sample Applications" from the update center (1.1) Start GlassFish v3 update center ...

#029 J2SE 5.0 Concurrency

미분류
Lab Exercises Exercise 1: ThreadPool (30 minutes) Exercise 2: Executors (30 minutes) Exercise 3: Callable and Future (30 minutes) Exercise 4: Semaphore(30 minutes) Exercise 5: Blocking queue (30 minutes) Homework Exercise (for people who are taking Sang Shin's "Java Programming online course")   Exercise 1: ThreadPoolExecutor In this exercise, you will learn how to create a pool of threads using the ThreadPoolExecutor class. You also will learn how these pool of threads are used to execute tasks. Build and run a server that receives connection request (using ThreadPoolExecutor) Build and run two instances of clients (1.1) Build and run a server that receives connection request (using ThreadPoolExecutor) 0. Start NetBeans IDE if you have not done so y...

#028 J2SE 5.0 Annotations

미분류
Lab Exercises Exercise 1: Override annotation (20 minutes) Exercise 2: Single member annotation (20 minutes) Exercise 3: Multiple member annotation (20 minutes) Exercise 4: Complex annotation (20 minutes) Exercise 5: Meta annotation (20 minutes) Exercise 6: Reading annotations at runtime (20 minutes) Homework Exercise (for people who are taking Sang Shin's "Java Programming online course")   Exercise 1: Override annotation Programmers sometimes overload a method when they mean to override it; a classic example of this is the equals() method which is defined in the Object class.  AnnotatedClass.java contains a simple example of this: public boolean equals(String otherName) { int comparisson = name.compareTo(otherName); return (comparisson == 0); } ...

#027 J2SE 5.0 Generics

미분류
Lab Exercises Exercise 1: Use Generic classes (20 minutes) Exercise 2: Generics and Subtyping (20 minutes) Exercise 3: Wild card (20 minutes) Exercise 4: Define your own generic class (20 minutes) Exercise 5: Type erasure (20 minutes) Exercise 6: Interoperating with non-generic code (20 minutes) Homework Exercise (for people who are taking Sang Shin's "Java Programming online course")   Exercise 1: Use Generic classes with type parameters In this exercise, you will learn the basic concept of Generics by adding lines of code to the Main.java.  You will try to reason why some code work while others result in compilation errors.  Technical explanations are then followed. (1.1) Compile time type checking through Generics 0. Start NetBeans IDE if you have not don...

#026 J2SE 5.0 Language Features Enhancements

미분류
Lab Exercises Exercise 1: Autoboxing (20 minutes) Exercise 2: Enhanced For loop (20 minutes) Exercise 3: Static imports (20 minutes) Exercise 4: Variable arguments (20 minutes) Exercise 5: Type-safe enumerations (20 minutes) Homework Exercise (for people who are taking Sang Shin's "Java Programming online course") Exercise 1: Autoboxing As any Java programmer knows, you cannot put an int (or other primitive value) into a collection. Collections can only hold object references, so you have to box primitive values into the appropriate wrapper class (which is Integer in the case of int). When you take the object out of the collection, you get the Integer that you put in; if you need an int, you must unbox the Integer using the intValue method. All of this boxing and unbo...

#025 Java Threads

미분류
Lab Exercises Exercise 1: Extending Thread class (30 minutes) Exercise 2: Implementing Runnable interface (30 minutes) Exercise 3: ThreadGroup, ThreadPriority, View all threads (30 minutes) Exercise 4: Synchronization (30 minutes) Exercise 5: Inter-thread communication (30 minutes) Exercise 6: Timer and TimerTask (15 minutes) Homework Exercise (for people who are taking Sang Shin's "Java Programming online course")   Exercise 1: Extending Thread class In this exercise, you are going to learn how to create and start a thread execution by writing a class that extends Thread class.  You will learn how to start the thread either by not having the start() method in the constructor of the subclass or having it in the constructor method of the subclass. The start()...

#024 Java Networking

미분류
Lab Exercises Exercise 1: Write client and server (30 minutes) Exercise 2: Write Multicast client and server (30 minutes) Homework Exercise (for people who are taking Sang Shin's "Java Programming online course")   Exercise 1: Writing Client and Server In this exercise, you are going to build and run a simple Hello server and client using Networking API. Build and run the server side code Build and run the client side code (1.1) Build and run the server side code 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 a...

#023 Java Serialization

미분류
Lab Exercises Exercise 1: Serialize and deserialize an object (20 minutes) Exercise 2: Customizing default protocol (20 minutes) Exercise 3: Buffered stream (20 minutes) Homework Exercise (for people who are taking Sang Shin's "Java Programming online course")   Exercise 1: Serialize and Deserialize an object In this exercise, you will learn how to do serialization and deserialization of the an object.  You will also learn how to use transient keyword. Serialize the current time Use transient keyword (1.1) Serialize the current time 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 ...

#022 Java Stream I/O

미분류
Lab Exercises Exercise 1: Byte stream (20 minutes) Exercise 2: Character stream (20 minutes) Exercise 3: Buffered stream (20 minutes) Exercise 4: Data stream (20 minutes) Exercise 5: Object stream (20 minutes) Exercise 6: Pipe stream (20 minutes) Exercise 7: File handling (20 minutes) Exercise 8: Filtered stream (20 minutes) Exercise 9: Scanner and Formatter (20 minutes) Homework Exercise (for people who are taking Sang Shin's "Java Programming online course")   Exercise 1: Byte stream In this exercise, you will learn how to use FileInputStream class which is InputStream type and FileOutputStream class which is OutputStream type to read from and write to a file. (1.1) Write an application that uses FileInputStream and FileOutputStream 0. Start NetBeans...