1 / 9

Java Overview

Java Overview. February 4, 2004. Assignments. Due – Homework 1 Due – Reading and Warmup questions Project 1 – Basic Networking. Hello.java. public class Hello

luisa
Download Presentation

Java Overview

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Java Overview February 4, 2004

  2. Assignments • Due – Homework 1 • Due – Reading and Warmup questions • Project 1 – Basic Networking

  3. Hello.java public class Hello { public static void main(String[] args) { //display a greeting in the console window System.out.println(“Hello, World!”); } }

  4. What is an object? • Instance of a class • Basic entity manipulated in a Java program • Program is made of multiple objects interacting • Ex. – coffee machine – Coins, Cups, ??? • Behavior – methods called on objects • Classes define the behavior

  5. BankAccount.java http://www.nmsl.cs.ucsb.edu/~srollins/courses/cs5-m02/web/code/71/BankAccount.java http://www.nmsl.cs.ucsb.edu/~srollins/courses/cs5-m02/web/code/71/BankAccountTest.java

  6. Threads • Lightweight process • Would like to be able to do “two things at once” • Create a thread to do each thing

  7. Threads Example // Construct an object to process the HTTP request message. HttpRequest request = new HttpRequest(connectionSocket); // Create a new thread to process the request. Thread thread = new Thread(request); // Start the thread. thread.start(); class HttpRequest implements Runnable // Implement the run() method of the Runnable interface. public void run()

  8. Graphical User Interface • UIExample.java

  9. Other Helpful Hints

More Related