Java the UML Way version 2002-04-17 Only to be used in connection with the book "Java the UML Way", by Else Lervik and.

Slides:



Advertisements
Similar presentations
Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming.
Advertisements

Lecture 2: Do you speak Java?. From Problem to Program Last Lecture we looked at modeling with objects! Steps to solving a business problem –Investigate.
1 Introduction to Java and Applet Lecture 3 from Chapters 1 and 2 of the complete reference.
Java Programming Working with TextPad. Using TextPad to Work with Java This text editor is designed for working with Java You can download a trial version.
1 Applets Chapter 1 To understand:  why applets are used to extend the capabilities of Web pages  how an applet is executed and know about the restrictions.
©2004 Brooks/Cole Chapter 1: Getting Started Sections Covered: 1.1Introduction to Programming 1.2Constructing a Java Program 1.3The print() and println()
Active X Microsoft’s Answer to Dynamic Content Reference: Using Active X by Brian Farrar QUE
CS1020: Intro Workshop. Topics CS1020Intro Workshop Login to UNIX operating system 2. …………………………………… 3. …………………………………… 4. …………………………………… 5. ……………………………………
Introduction to Java.
Introduction to JavaScript. Aim To enable you to write you first JavaScript.
CIS101 Introduction to Computing Week 06. Agenda Your questions Excel Exam during second hour Our status after the snow day Introduction to the Internet.
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
Introduction to Java Programming. Contents 1. Java, etc. 2. Java's Advantages 3. Java's Disadvantages 4. Types of Java Code 5. Java Bytecodes 6. Steps.
INTRODUCTION TO WEB DATABASE PROGRAMMING
Introduction to Java Tonga Institute of Higher Education.
Lecture 1 Introduction to Java MIT- AITI 2004 What is a Computer Program? For a computer to be able to do anything (multiply, play a song, run a word.
A First Program Using C#
Chapter 16 The World Wide Web Chapter Goals Compare and contrast the Internet and the World Wide Web Describe general Web processing Describe several.
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
CSCI 273: Processing An Introduction. Programming Languages –An abstract "human understandable" language for telling the computer what to do –The abstract.
How Java Programs Work MIS 3023 Business Programming Concepts II The University of Tulsa Professor: Akhilesh Bajaj All slides in this presentation ©Akhilesh.
Java the UML Way versjon Only to be used in connection with the book "Java the UML Way", by Else Lervik and.
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
Computer Programming 12 Mr. Jean March 19 th, 2013.
Lecture 1 Introduction to Java MIT-AITI Ethiopia 2004.
UCSC All rights reserved. No part of this material may be reproduced and sold. 1 IT1202-Fundamentals Of Programming (Using JAVA) Interacting with.
1 Computer Systems -- Introduction  Chapter 1 focuses on:  the structure of a Java application  basic program elements  preparing and executing a program.
1.8History of Java Java –Based on C and C++ –Originally developed in early 1991 for intelligent consumer electronic devices Market did not develop, project.
Java Applets. 2 Introduction to Java Applet Programs  Applications are stand alone programs executed with Java interpreter executed with Java interpreter.
Chapter 8 Introduction to HTML and Applets Fundamentals of Java.
OOP (Java): Simple/ OOP (Java) Objectives – –give some simple examples of Java applications and one applet 2. Simple Java Programs Semester.
1 Week 1 l HTML l Applets Applets and HTML. 2 Overview l Applets: Java programs designed to run from a document on the Internet l HTML: Hypertext Markup.
Chapter 13. Applets and HTML HTML Applets Computer Programming with JAVA.
1 CSC204 – Programming I Lecture 2 Intro to OOP with Java.
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
POS 406 Java Technology And Beginning Java Code
Programming Concept Chapter I Introduction to Java Programming.
The Joy of Programming (also known as) Introduction to Object-Oriented Programming.
Java the UML Way version Only to be used in connection with the book "Java the UML Way", by Else Lervik and.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
Java the UML Way version Only to be used in connection with the book "Java the UML Way", by Else Lervik and.
Chapter 1 Section 1.1 Introduction to Java Slides prepared by Rose Williams, Binghamton University Kenrick Mock, University of Alaska Anchorage.
Introduction to Java Programming. Introduction Course Objectives Organization of the Book.
Java Applets. 2 Introduction to Java Applet Programs Applications are ___________________ programs –executed with Java interpreter Applet is a small program.
Java the UML Way versjon Only to be used in connection with the book "Java the UML Way", by Else Lervik and.
Java the UML Way version Only to be used in connection with the book "Java the UML Way", by Else Lervik and.
Mini University July, 2005 A Little Taste of Java (but don’t tell your folks) (they might think there’s caffeine involved)
Java and its Evolution. Contents Java Introduction Java Features How Java Differs from other OO languages Java and the World Wide Web Java Environment.
Object Oriented Programming Examples: C++, Java Advantages: 1. reusibility of code 2. ability to adapt (extend) previously written code.
Copyright © Mohamed Nuzrath Java Programming :: Syllabus & Chapters :: Prepared & Presented By :: Mohamed Nuzrath [ Major In Programming ] NCC Programme.
Java Methods Methods contain a group of instructions that together perform a single task. For example if I want to perform the task of “making a pizza”,
Lecture 1. Introduction to Programming and Java MIT- AITI 2003.
Java Programming, Second Edition Appendix A Working with Java SDK 1.4.
Java the UML Way version Only to be used in connection with the book "Java the UML Way", by Else Lervik and.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
By Tharith Sriv. To write a web page you use: HHTML (HyperText Markup Language), AASP (Active Server Page), PPHP (HyperText Preprocessor), JJavaScript,
Java the UML Way version Only to be used in connection with the book "Java the UML Way", by Else Lervik and.
Java the UML Way versjon Only to be used in connection with the book "Java the UML Way", by Else Lervik and.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
Today… “Hello World” ritual. Brief History of Java & How Java Works. Introduction to Java class structure. But first, next slide shows Java is No. 1 programming.
JavaScript 101 Introduction to Programming. Topics What is programming? The common elements found in most programming languages Introduction to JavaScript.
3/5/2002e-business and Information Systems1 Java Java Java Virtual Machine (JVM) Java Application Program Interface (API) HW Kernel API Application Programs.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Lesson 2: First Java Programs. 2.1 Why Java? Java is one of the most popular programming languages in the world. Java is a modern object-oriented programming.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
Chapter No. : 1 Introduction to Java.
Text by: Lambert and Osborne
Java Applets.
Tutorial Developing a Basic Web Page
Review of Previous Lesson
Presentation transcript:

Java the UML Way version Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 1 Introduction Preliminaries for reading this book page 2 Familiarize yourself with the book and the web page!page 3 We can contemplate the computer as layeredpage 4 Two types of Java programspage 5 A small program (an application) page 6-7 From source code to runnable programpage 8-9 Running an appletpage 10

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 1, page 2 Preliminaries for Reading This Book You have used a computer for a while. You know –the use of Windows incl. Windows Explorer, cut and paste, etc. –the terms file, directory and sub-directory You know a little about the significance of a file’s extension, examples: –Windows program files have the extension exe. –Files with the extension doc are data files - input for the application Word. –Note the difference between program files and data files. You have some experience in the use of the Internet. Windows has a graphical user interface. MS-DOS-prompt is an example of a textual user interface, where we type commands to navigate the files. An advantage to know a few such commands. You know a little about the computer’s construction: –microprocessor –internal memory (RAM) and secondary memory

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 1, page 3 Familiarize Yourself with the Book and the Web Page! The web page: Every chapter has the following elements: –Introduction with learning-goals –The chapter text Most sections end with small problems. The most important ones are included in this series of slides, connected to the relevant text. Solutions to the problems are on the web page. All numbered example programs are on the web page, for downloading and running. –At the end of every chapter Review problems, covering the most important parts of the chapter. Programming problems. Solutions for many of these are on the web page. List with explanations of new concepts. And remember: It is not possible to become a good programmer by reading. You have to program a lot.

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 1, page 4 We Can Contemplate the Computer as ”Layered” Graphical windows system Command shell Kernel fopen, fclose C:\DOS> dir a small amount of commands (”calls)” working on the internals of the computer textual user interface, many available commands, each of them corresponding to several kernel commands The distinction between the layers isn’t clear on all systems. In some systems, however, the distinction is clear enough to easily switch windows systems.

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 1, page 5 Two Types of Java Programs Java applets –When you fetch a page on the web, the page is transferred from a server machine (where the page is stored) to a client machine (your computer). –You read the web page by means of a program called a browser (i.e. Netscape or Microsoft Explorer). –The page may refer to a (a bit special) type of program file stored on the server machine. –The program file is transferred to the client machine, and the browser runs the program. –Such a program is an applet, and is stored on a file with the extension class. Java applications –These are ”ordinary programs”, not only for the Internet. –Has the extension class, not exe. –Run by a program called java. –Not necessarily connected to the Internet at all.

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 1, page 6 A Small Program (an Application) We type in the program as plain text. We can’t add formatting such as italics or different fonts. Therefore we don’t use a word processor, but a text editor, when typing in programs. Notepad, WinEdit and TextPad are examples of text editors. TextPad:

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 1, page 7 The Program PrintText.java /* * PrintText.java VBH * Prints text several times * */ class PrintText { public static void main(String[] args) { System.out.println("Our first program..."); for (int i = 0 ; i<10 ; i++) System.out.println("About to learn Java!"); } class name comments file name same as class name, with extension java. print one line do next thing 10 times Our first program... About to learn java!About to learn java!About to learn java!About to learn java!About to learn java! printout when running the program

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 1, page 8 From Source Code to Runnable Program The program code we type in is called source code. It is a good habit to put the source code on a file with the same name as the class. Many tools enforce this. The file name must have the extension java. Here: PrintText.java. Mind the upper and lower case. Java programs must be translated into byte code. The byte code can be run on several types of computers. –Necessary when applets are downloaded from the Internet. The Java interpreter translates into the relevant machine code. Programs written in other programming languages are often translated directly into machine code (the language which the microprocessor uses). Source code, HelloWorld.java Byte code, HelloWorld.class. class HelloW... public static... ¤() CompilingRunning by an interpreter

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 1, page 9 How to Run the Program (Application) We need –A program which translates from source code to byte code: javac.exe –A program which takes the byte code and runs the program: java.exe - (The Java interpreter). In an MS-DOS window: –Assume that the file PrintText.java is in the directory c:\javaprograms. –Go to this directory: c:\windows>cd c:\javaprograms c:\javaprograms> javac PrintText.java c:\javaprograms> java PrintText The result is displayed in a window, and looks like this: In a tool/editor: –Many editors let you compile and run directly from where you type the program. Our first program... About to learn java!About to learn java!About to learn java!About to learn java!About to learn java!

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 1, page 10 Running an Applet An HTML file must contain a reference to the applet: – Let’s name the HTML file SimpleApplet.html. It can be run in more than one way: –With the program appletviewer: From the MS-DOS prompt: >appletviewer SimpleApplet.html From a tool: You have the applet’s source code in a window. You press for compiling and running of it. Often, a tiny HTML file is created on the fly, and this is passed to appletviewer. appletviewer only shows the applet, not the other parts of the web page (HTML file). –The file can be opened in a web browser: file:///J|/USER/JavaBook/ExCh4/SimpleApplet.html –The file can be retrieved from a web server:

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 1, page 11 Before continuing you have to familiarize yourselves with the tools you are going to create your Java programs with. Do the downloading and installation, if not already done. See Appendix A. Make the program on page 10 work, so that the printout becomes like the one on page 11. If you use the SDK from Sun, try to use the procedure on pages Find the book’s web page, and find your way around. Download the solutions for the small problems.