Understanding How Java Programs Work

Size: px
Start display at page:

Download "Understanding How Java Programs Work"

Transcription

1 HOUR 4 Understanding How Java Programs Work An important distinction to make in Java programming is where your program is supposed to be running. Some programs are intended to work on your computer; you type in a command or click an icon to start them up. Other programs are intended to run as part of a World Wide Web page. You encountered several examples of this type of program during the previous hour s whirlwind vacation. Java programs that run locally on your own computer are called applications. Programs that run on web pages are called applets. During this hour, you ll learn why that distinction is important, and the following topics will be covered:. How applications work. Organizing an application. Sending arguments to an application. How applets work. The required parts of an applet. Sending parameters to an applet. Using HTML tags to put an applet on a page Creating an Application Although Java has become well-known because it can be used in conjunction with World Wide Web pages, you can also use it to write any type of computer program. The Saluton program you wrote during Hour 2, Writing Your First Program, is an example of a Java application. To try out another program, use your word processor to open up a new file and enter everything from Listing 4.1. Remember not to enter the line numbers and colons along the left side of the listing; these items are used to make parts of programs easier to describe in the book. When you re done, save the file as Root.java, making sure to save it in textonly or plain ASCII text format.

2 52 HOUR 4: Understanding How Java Programs Work LISTING 4.1 The Full Text of Root.java 1: class Root { 2: public static void main(string[] arguments) { 3: int number = 225; 4: System.out.println( The square root of 5: + number 6: + is 7: + Math.sqrt(number) ); 8: } 9: } The Root application accomplishes the following tasks:. Line 3: An integer value of 225 is stored in a variable named number.. Lines 4 7: This integer and its square root are displayed. The Math.sqrt (number) statement in Line 7 displays the square root. Before you can test out this application, you need to compile it using the Java Development Kit s javac compiler or the compiler included with another Java development environment. If you re using the JDK, go to a command line, open the folder that contains the Root.java file, and then compile Root.java by entering the following at a command line: javac Root.java If you have entered Listing 4.1 without any typos, including all punctuation and every word capitalized exactly as shown, it should compile without any errors. The compiler responds to a successful compilation by not responding with any message at all. Java applications are compiled into a class file that can be run by a Java interpreter. If you re using the JDK, you can run the compiled Root.class file by typing this command: java Root The output should be the following: The square root of 225 is 15.0 When you run a Java application, the interpreter looks for a main() block and starts handling Java statements within that block. If your program does not have a main() block, the interpreter will respond with an error.

3 Sending Arguments to Applications 53 Sending Arguments to Applications Because Java applications are run from a command line, you can send information to applications at the same time you run them. The following hypothetical example uses the java interpreter to run an application called TextDisplayer, and it sends two extra items of information to the application, readme.txt and /p: java TextDisplayer readme.txt /p Extra information you can send to a program is called an argument. The first argument, if there is one, is provided one space after the name of the application. Each additional argument is also separated by a space. If you want to include a space inside an argument, you must put quotation marks around the argument, as in the following: java TextDisplayer readme.txt /p Page Title This example runs the TextDisplayer program with three arguments: readme.txt, /p, and Page Title. The quote marks prevent Page and Title from being treated as separate arguments. You can send as many arguments as you want to a Java application. In order to do something with them, however, you have to write some statements in the application to handle them. To see how arguments work in an application, create a new file in your word processor called Blanks.java. Enter the text of Listing 4.2 into the file and save it when you re done. Compile the program, correcting any errors that are caused by typos. LISTING 4.2 The Full Text of Blanks.java 1: class Blanks { 2: public static void main(string[] arguments) { 3: System.out.println( The + arguments[0] 4: + + arguments[1] + fox 5: + jumped over the 6: + arguments[2] + dog. ); 7: } 8: } To try out the Blanks application, run it with a Java interpreter such as the JDK s java tool. Give it three adjectives of your own choosing as arguments, as in the following example: java Blanks retromingent purple lactose-intolerant

4 54 HOUR 4: Understanding How Java Programs Work The application uses the adjectives to fill out a sentence. Here s the one produced by the preceding three arguments: The retromingent purple fox jumped over the lactose-intolerant dog. Try it with some of your own adjectives, making sure to always include at least three of them. Arguments are a useful way to customize the performance of a program. They often are used to configure a program so it runs a specific way. Java stores arguments in arrays, groups of related variables that all hold the same information. You ll learn about arrays during Hour 9, Storing Information with Arrays. Watch Out! When you run the Blanks application, you must include at least three words as command-line arguments. If not, you ll see an intimidating error message mentioning an ArrayOutOfBoundsException, something that will be complete gobbledygook for another five hours. Applet Basics When the Java language was introduced in 1995, the language feature that got the most attention was applets, Java programs that run on a World Wide Web page. Before Java, web pages were a combination of text, images, and forms that used Common Gateway Interface programs running on the computer that hosted the pages. These gateway programs required special access to the web server presenting the page. Applets require no special access and can be written by programmers of all skill levels. You ll write several during the span of these 24 hours. You can test them with any web browser that handles Java programs. Most of the Java programs you toured during the previous hour were all applets. Their structure differs from applications in several important ways, and they are designed specifically for presentation on the Web. By the Way Because the applets you ll write in this book use Java 2, these applets must be run with a browser that supports the most current version of the language. During Hour 17, Creating Interactive Web Programs, you ll learn how to set up a browser to use the Java plug-in to run Java 2 applets. All applets can also be tested with the appletviewer tool that is included with the Java Development Kit. Unlike applications, applets do not have a main() block. Instead, they have several different sections that are handled depending on what is happening in the applet, as detailed fully during Hour 17. Two of the sections are the init() block statement and the paint() block. init() is short for initialization, and it is used to take care

5 Applet Basics 55 of anything that needs to be set up as an applet first runs. The paint() block is used to display anything that should be displayed. To see an applet version of the Root application, create a new file in your word processor and call it RootApplet.java. Enter the code in Listing 4.3 and save it when you re done. LISTING 4.3 The Full Text of RootApplet.java 1: import java.awt.*; 2: 3: public class RootApplet extends javax.swing.japplet { 4: int number; 5: 6: public void init() { 7: number = 225; 8: } 9: 10: public void paint(graphics screen) { 11: Graphics2D screen2d = (Graphics2D) screen; 12: screen2d.drawstring( The square root of + 13: number + 14: is + 15: Math.sqrt(number), 5, 50); 16: } 17: } Compile this file using your Java development software. If you are using the javac compiler tool in the JDK, type the following at a command line: javac RootApplet.java This program contains a lot of the same statements as the Root application that did the same thing. The primary difference is in how it is organized the main() block has been replaced with an init() block and a paint() block. The sample programs in this hour are provided primarily to introduce you to the way Java programs are structured. Some aspects of these programs will be introduced fully later, so don t feel like you re falling behind. The main purpose of this hour is to get the programs to compile and see how they function when you run them. By the Way Unlike applications, compiled Java applets cannot be tested using a Java interpreter. You have to put them on a web page and view that page in one of two ways:. Use a web browser that can handle Java 2 applets by using Sun s Java plug-in, which requires special configuration of the web page.. Use the appletviewer tool that comes with the Java Development Kit.

6 56 HOUR 4: Understanding How Java Programs Work To create a web page that can display the RootApplet program, return to your word processor and create a new file. Enter Listing 4.4 in that file and save it as RootApplet.html. LISTING 4.4 The Full Text of RootApplet.html 1: <applet code= RootApplet.class height= 100 width= 300 > 2: </applet> This web page contains the bare minimum needed to display a Java applet on a web page. The applet tag is used to specify that a Java program is being put on the page, the code attribute provides the name of the applet, and the height and width attributes describe the size of the applet s display area. These items will be described in detail during Hour 17. To see this applet using the appletviewer tool included with Java Development Kit, type the following at a command line: appletviewer RootApplet.html To see it using your computer s default web browser, type the following command instead: RootApplet.html You also can load this page with your browser: Choose File, Open, then navigate to the folder that contains RootApplet.html and select the file. Figure 4.1 shows what the applet looks like when loaded with Mozilla Firefox. FIGURE 4.1 The RootApplet applet displayed with a web browser.

7 Sending Parameters to Applets 57 If you try to load this page with your web browser and get an error, the most likely cause is that your browser is not yet equipped with the Java plug-in. To correct this, visit the web page to download and install the free Java Runtime Environment, which includes the Java plug-in. Watch Out! Sending Parameters to Applets Java applets are never run from the command line, so you can t specify arguments the way you can with applications. Applets use a different way to receive information at the time the program is run. This configuration information is called parameters, and you can send parameters through the HTML page that runs the applet. You have to use a special HTML tag for parameters called param. To see how the Blanks application would be rewritten as an applet, open your word processor, enter the text of Listing 4.5, then save the file as BlanksApplet.java. LISTING 4.5 The Full Text of BlanksApplet.java 1: import java.awt.*; 2: 3: public class BlanksApplet extends javax.swing.japplet { 4: String parameter1; 5: String parameter2; 6: String parameter3; 7: 8: public void init() { 9: parameter1 = getparameter( adjective1 ); 10: parameter2 = getparameter( adjective2 ); 11: parameter3 = getparameter( adjective3 ); 12: } 13: 14: public void paint(graphics screen) { 15: screen.drawstring( The + parameter1 16: + + parameter2 + fox 17: + jumped over the 18: + parameter3 + dog., 5, 50); 19: } 20: } Save the file and then compile it. Using the JDK, you can accomplish this by typing the following at the command line: javac BlanksApplet.java Before you can try out this applet, you need to create a web page that displays the BlanksApplet applet after sending it three adjectives as parameters. Open your word processor and enter Listing 4.6, saving it as BlanksApplet.html.

8 58 HOUR 4: Understanding How Java Programs Work LISTING 4.6 The Full Text of BlanksApplet.html 1: <applet code= BlanksApplet.class height=80 width=500> 2: <param name= adjective1 value= lachrymose > 3: <param name= adjective2 value= magenta > 4: <param name= adjective3 value= codependent > 5: </applet> Save the file when you re done, and load the page using Internet Explorer, the JDK s appletviewer, or another browser equipped with the Java plug-in. The page when loaded in your browser should resemble Figure 4.2. Change the values of the value attribute in Lines 2 4 of the BlanksApplet.html file, replacing lachrymose, magenta, and codependent with your own adjectives, then save the file and run the program again. Try this several times, and you ll see that your program is now flexible enough to handle any adjectives, no matter how well or how poorly they describe the strange relationship between the fox and the dog. FIGURE 4.2 The BlanksApplet program displayed with a web browser. You can use as many parameters as needed to customize the operation of an applet, as long as each has a different name attribute specified along with the param tag. Workshop: Viewing the Code Used to Run Applets As a short workshop to better familiarize yourself with the applet tag and how it can be used to alter the performance of an applet, visit this book s World Wide Web site at Load this site by using one of the web browsers that can run Java applets, such as Microsoft Internet Explorer, Mozilla Firefox, or Apple Safari. Go to the section of the site labeled Hour 4 Showcase, and you ll be given a guided tour through several working examples of applets.

9 Q&A 59 On each of the pages in the Hour 4 Showcase, you can use a pull-down menu command to view the HTML tags that were used to create the page:. In Internet Explorer or Opera, choose View, Source.. In Navigator or Firefox, choose View, Page Source. Compare the parameters that are used with each applet to the way the applet runs. Appendix E, This Book s Website, describes other things you can find on the book s site. The website is intended as a complement to the material covered in this book, and a way to find out about corrections, revisions, or other information that make these 24 hours more productive. Summary During this hour, you had a chance to create both a Java application and an applet. These two types of programs have several important differences in the way they function and the way they are created. Both kinds of Java programs can be easily customized at the time they are run. Applications use arguments, which are specified on the command line at the time the program is run. Applets use parameters, which are included on the web page that displays the applet by using HTML tags. The next several hours will continue to focus on applications as you become more experienced as a Java programmer. Applications are quicker to test because they don t require you to create a web page to view them; they can be easier to create and more powerful as well. Q&A Q Can a single Java program be both an applet and an application? A It is possible to make a program serve as both applet and application, but it s often an unwieldy solution unless the program is simple. An applet could be set up to run as an application also by including a main() block in the applet, but you would not be able to use the init() block or paint() block in the automatic fashion they are used in an applet. Most programs are written as either an application or as an applet, rather than attempting to do both. Q Do all arguments sent to a Java application have to be strings? A Java makes all arguments into strings for storage when an application runs. When you want to use one of these arguments as an integer or some other

10 60 HOUR 4: Understanding How Java Programs Work non-string type, you have to convert the value. You ll learn how to do this during Hour 11, Describing What Your Object Is Like. Q I get errors when I try to load RootApplet.html into either Mozilla Firefox or Microsoft Internet Explorer. What s the problem? A In most cases, the problem is that the browser isn t equipped to run Java 2 applets. Internet Explorer and Firefox lack support for Java 2 applets, which are run by the Java plug-in offered by Sun. When you re in doubt about why an applet won t work in a browser, try loading it with the appletviewer tool included with the Java Development Kit. If it works in appletviewer, the problem is with the browser rather than your Java applet. Q Why don t Java applets require the same kind of special access as Common Gateway Interface programs? A Java applets don t have the same access requirements because they don t pose the same risk to a website provider. A Common Gateway Interface (CGI) program is run by the provider s web server. A web server administrator must trust the people writing gateway programs, because there s no security to prevent the program from harming the server presenting the web page, whether intentionally or by mistake. Java applets, on the other hand, have strict restrictions to prevent them from being used to write harmful programs. Also, Java programs do not run on a website s server they run on the computer of the person viewing the page. This also means that the server will not slow down due to numerous people running a Java applet on a page. Q In the movie, It s a Wonderful Life, Sam Wainwright cabled Bedford Falls from London authorizing his local office to advance George Bailey up to $25,000 to help him. How much would this money be worth in today s dollars? A Assuming that the scene took place on Christmas Eve 1945, Wainwright s offer was equivalent to $263,000 in current dollars. More inflation-adjusted figures from the 1946 film: The $8,000 Bailey Building and Loan deposit stolen by Henry Potter is equal to $84,000 today and the $5,000 loan that William Bailey owed Potter in 1919 is like $61,000. Also in 1919, George Bailey clicked a drugstore lighter and wished for a million dollars. Children today must wish for $12.3 million to be equally enriched.

11 Quiz 61 S. Morgan Friedman offers an inflation calculator on the Web at He uses Consumer Price Index statistics from the Historical Statistics of the United States and the Statistical Abstract of the United States. Quiz Test your knowledge of the material covered in this chapter by answering the following questions. Questions 1. Which type of Java program can be run by a Java interpreter? a. Applets b. Applications c. None 2. What special HTML tag is used to put a Java program onto a web page? a. <applet> b. <program> c. <run> 3. If you get into a fight with someone over the way to send information to a Java application, what are you doing? a. Struggling over strings b. Arguing about arguments c. Feudin for functionality

12 62 HOUR 4: Understanding How Java Programs Work Answers 1. b. Applications are run with the interpreter tool, and web pages containing applets can be run with the appletviewer tool as well as Java-capable World Wide Web browsers. 2. a. The <applet> tag is used along with the <param> tag to send parameters to the applet. You ll learn about a second tag that can be used to present applets during Hour b. Applications receive information in the form of arguments. Can t we all just get along? Activities If you would like to apply your acumen of applets and applications, the following activities are suggested:. Check out EarthWeb s Java Applet Ratings Service website at and use the search term headline to see links and descriptions to all of the applets that have been written to display news headlines. Each of these applets uses parameters to modify the text that is displayed.. Write a Java applet that can handle a parameter named X and a parameter named Y. Display the two parameters in a drawstring() statement like the one in the BlanksApplet program. To see a Java program that implements the second activity, visit the book s website at

Road Map. Introduction to Java Applets Review applets that ship with JDK Make our own simple applets

Road Map. Introduction to Java Applets Review applets that ship with JDK Make our own simple applets Java Applets Road Map Introduction to Java Applets Review applets that ship with JDK Make our own simple applets Introduce inheritance Introduce the applet environment html needed for applets Reading:

More information

GETTING STARTED. The longest journey begins with a single step. In this chapter, you will learn about: Compiling and Running a Java Program Page 2

GETTING STARTED. The longest journey begins with a single step. In this chapter, you will learn about: Compiling and Running a Java Program Page 2 ch01 11/17/99 9:16 AM Page 1 CHAPTER 1 GETTING STARTED The longest journey begins with a single step. CHAPTER OBJECTIVES In this chapter, you will learn about: Compiling and Running a Java Program Page

More information

4. Java Project Design, Input Methods

4. Java Project Design, Input Methods 4-1 4. Java Project Design, Input Methods Review and Preview You should now be fairly comfortable with creating, compiling and running simple Java projects. In this class, we continue learning new Java

More information

Chapter 4 The Companion Website A Unique Online Study Resource 4.1 Locating Companion Web sites

Chapter 4 The Companion Website A Unique Online Study Resource 4.1 Locating Companion Web sites Chapter 4 The Companion Website A Unique Online Study Resource As a student, you are no doubt familiar with the various supplements produced in conjunction with your textbooks. From videotapes to workbooks,

More information

Software Concepts. 2-8 Explain the process of translating and executing a Java program. How might the World Wide Web be involved?

Software Concepts. 2-8 Explain the process of translating and executing a Java program. How might the World Wide Web be involved? CHAPTER 2 Software Concepts Notes This chapter explores how programs are written and the process of compiling a program into machine language. Basic programs are presented and discussed. High-level software

More information

Java Applets. Last Time. Java Applets. Java Applets. First Java Applet. Java Applets. v We created our first Java application

Java Applets. Last Time. Java Applets. Java Applets. First Java Applet. Java Applets. v We created our first Java application Last Time v We created our first Java application v What are the components of a basic Java application? v What GUI component did we use in the examples? v How do we write to the standard output? v An

More information

Get JAVA. I will just tell you what I did (on January 10, 2017). I went to:

Get JAVA. I will just tell you what I did (on January 10, 2017). I went to: Get JAVA To compile programs you need the JDK (Java Development Kit). To RUN programs you need the JRE (Java Runtime Environment). This download will get BOTH of them, so that you will be able to both

More information

Chapter 7 Applets. Answers

Chapter 7 Applets. Answers Chapter 7 Applets Answers 1. D The drawoval(x, y, width, height) method of graphics draws an empty oval within a bounding box, and accepts 4 int parameters. The x and y coordinates of the left/top point

More information

The Dynamic Typing Interlude

The Dynamic Typing Interlude CHAPTER 6 The Dynamic Typing Interlude In the prior chapter, we began exploring Python s core object types in depth with a look at Python numbers. We ll resume our object type tour in the next chapter,

More information

An applet is a program written in the Java programming language that can be included in an HTML page, much in the same way an image is included in a

An applet is a program written in the Java programming language that can be included in an HTML page, much in the same way an image is included in a CBOP3203 An applet is a program written in the Java programming language that can be included in an HTML page, much in the same way an image is included in a page. When you use a Java technology-enabled

More information

1 Getting started with Processing

1 Getting started with Processing cis3.5, spring 2009, lab II.1 / prof sklar. 1 Getting started with Processing Processing is a sketch programming tool designed for use by non-technical people (e.g., artists, designers, musicians). For

More information

AP Computer Science Unit 1. Writing Programs Using BlueJ

AP Computer Science Unit 1. Writing Programs Using BlueJ AP Computer Science Unit 1. Writing Programs Using BlueJ 1. Open up BlueJ. Click on the Project menu and select New Project. You should see the window on the right. Navigate to wherever you plan to save

More information

Introduction to Java Unit 1. Using BlueJ to Write Programs

Introduction to Java Unit 1. Using BlueJ to Write Programs Introduction to Java Unit 1. Using BlueJ to Write Programs 1. Open up BlueJ. Click on the Project menu and select New Project. You should see the window on the right. Navigate to wherever you plan to save

More information

PROGRAMMING LANGUAGE 2

PROGRAMMING LANGUAGE 2 1 PROGRAMMING LANGUAGE 2 Lecture 13. Java Applets Outline 2 Applet Fundamentals Applet class Applet Fundamentals 3 Applets are small applications that are accessed on an Internet server, transported over

More information

AP Computer Science Unit 1. Writing Programs Using BlueJ

AP Computer Science Unit 1. Writing Programs Using BlueJ AP Computer Science Unit 1. Writing Programs Using BlueJ 1. Open up BlueJ. Click on the Project menu and select New Project. You should see the window on the right. Navigate to wherever you plan to save

More information

Programming In Java Prof. Debasis Samanta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Programming In Java Prof. Debasis Samanta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Programming In Java Prof. Debasis Samanta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 06 Demonstration II So, in the last lecture, we have learned

More information

Goals. Java - An Introduction. Java is Compiled and Interpreted. Architecture Neutral & Portable. Compiled Languages. Introduction to Java

Goals. Java - An Introduction. Java is Compiled and Interpreted. Architecture Neutral & Portable. Compiled Languages. Introduction to Java Goals Understand the basics of Java. Introduction to Java Write simple Java Programs. 1 2 Java - An Introduction Java is Compiled and Interpreted Java - The programming language from Sun Microsystems Programmer

More information

2SKILL. Variables Lesson 6. Remembering numbers (and other stuff)...

2SKILL. Variables Lesson 6. Remembering numbers (and other stuff)... Remembering numbers (and other stuff)... Let s talk about one of the most important things in any programming language. It s called a variable. Don t let the name scare you. What it does is really simple.

More information

Chapter Two Bonus Lesson: JavaDoc

Chapter Two Bonus Lesson: JavaDoc We ve already talked about adding simple comments to your source code. The JDK actually supports more meaningful comments as well. If you add specially-formatted comments, you can then use a tool called

More information

Introduction to Computer Science I

Introduction to Computer Science I Introduction to Computer Science I Graphics Janyl Jumadinova 7 February, 2018 Graphics Graphics can be simple or complex, but they are just data like a text document or sound. Java is pretty good at graphics,

More information

Organising . page 1 of 8. bbc.co.uk/webwise/accredited-courses/level-one/using- /lessons/your- s/organising-

Organising  . page 1 of 8. bbc.co.uk/webwise/accredited-courses/level-one/using- /lessons/your- s/organising- Organising email Reading emails When someone sends you an email it gets delivered to your inbox, which is where all your emails are stored. Naturally the first thing you ll want to do is read it. In your

More information

PHP and MySQL for Dynamic Web Sites. Intro Ed Crowley

PHP and MySQL for Dynamic Web Sites. Intro Ed Crowley PHP and MySQL for Dynamic Web Sites Intro Ed Crowley Class Preparation If you haven t already, download the sample scripts from: http://www.larryullman.com/books/phpand-mysql-for-dynamic-web-sitesvisual-quickpro-guide-4thedition/#downloads

More information

Mr G s Java Jive. #11: Formatting Numbers

Mr G s Java Jive. #11: Formatting Numbers Mr G s Java Jive #11: Formatting Numbers Now that we ve started using double values, we re bound to run into the question of just how many decimal places we want to show. This where we get to deal with

More information

Programming with Python

Programming with Python Programming with Python Dr Ben Dudson Department of Physics, University of York 21st January 2011 http://www-users.york.ac.uk/ bd512/teaching.shtml Dr Ben Dudson Introduction to Programming - Lecture 2

More information

A Step-by-Step Guide to getting started with Hot Potatoes

A Step-by-Step Guide to getting started with Hot Potatoes A Step-by-Step Guide to getting started with Hot Potatoes Hot Potatoes Software: http://web.uvic.ca/hrd/hotpot/ Andrew Balaam Objectives: To put together a short cycle of exercises linked together based

More information

Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller

Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller Table of Contents Introduction!... 1 Part 1: Entering Data!... 2 1.a: Typing!... 2 1.b: Editing

More information

CPSC 150 Laboratory Manual. Lab 1 Introduction to Program Creation

CPSC 150 Laboratory Manual. Lab 1 Introduction to Program Creation CPSC 150 Laboratory Manual A Practical Approach to Java, jedit & WebCAT Department of Physics, Computer Science & Engineering Christopher Newport University Lab 1 Introduction to Program Creation Welcome

More information

CMSC 201 Fall 2016 Lab 09 Advanced Debugging

CMSC 201 Fall 2016 Lab 09 Advanced Debugging CMSC 201 Fall 2016 Lab 09 Advanced Debugging Assignment: Lab 09 Advanced Debugging Due Date: During discussion Value: 10 points Part 1: Introduction to Errors Throughout this semester, we have been working

More information

Decisions: Logic Java Programming 2 Lesson 7

Decisions: Logic Java Programming 2 Lesson 7 Decisions: Logic Java Programming 2 Lesson 7 In the Java 1 course we learned about if statements, which use booleans (true or false) to make decisions. In this lesson, we'll dig a little deeper and use

More information

Module 5 Applets About Applets Hierarchy of Applet Life Cycle of an Applet

Module 5 Applets About Applets Hierarchy of Applet Life Cycle of an Applet About Applets Module 5 Applets An applet is a little application. Prior to the World Wide Web, the built-in writing and drawing programs that came with Windows were sometimes called "applets." On the Web,

More information

Page 1 of 7. public class EmployeeAryAppletEx extends JApplet

Page 1 of 7. public class EmployeeAryAppletEx extends JApplet CS 209 Spring, 2006 Lab 9: Applets Instructor: J.G. Neal Objectives: To gain experience with: 1. Programming Java applets and the HTML page within which an applet is embedded. 2. The passing of parameters

More information

HTML/CSS Lesson Plans

HTML/CSS Lesson Plans HTML/CSS Lesson Plans Course Outline 8 lessons x 1 hour Class size: 15-25 students Age: 10-12 years Requirements Computer for each student (or pair) and a classroom projector Pencil and paper Internet

More information

Soda Machine Laboratory

Soda Machine Laboratory Soda Machine Laboratory Introduction This laboratory is intended to give you experience working with multiple queue structures in a familiar real-world setting. The given application models a soda machine

More information

Lecture (01) Getting started. Dr. Ahmed ElShafee

Lecture (01) Getting started. Dr. Ahmed ElShafee Lecture (01) Getting started Dr. Ahmed ElShafee 1 Dr. Ahmed ElShafee, fundamentals of Programming I, Agenda Download and Installation Java How things work NetBeans Comments Structure of the program Writing

More information

Microsoft Expression Web Quickstart Guide

Microsoft Expression Web Quickstart Guide Microsoft Expression Web Quickstart Guide MS-Expression Web Quickstart Guide Page 1 of 24 Expression Web Quickstart Guide (20-Minute Training) Welcome to Expression Web. When you first launch the program,

More information

Running Java Programs

Running Java Programs Running Java Programs Written by: Keith Fenske, http://www.psc-consulting.ca/fenske/ First version: Thursday, 10 January 2008 Document revised: Saturday, 13 February 2010 Copyright 2008, 2010 by Keith

More information

You should now start on Chapter 4. Chapter 4 introduces the following concepts

You should now start on Chapter 4. Chapter 4 introduces the following concepts Summary By this stage, you have met the following principles : the relationship between classes and objects that a class represents our understanding of something weʼre interested in, in a special and

More information

AP Computer Science A Summer Assignment 2017

AP Computer Science A Summer Assignment 2017 AP Computer Science A Summer Assignment 2017 The objective of this summer assignment is to ensure that each student has the ability to compile and run code on a computer system at home. We will be doing

More information

Course Outline. Introduction to java

Course Outline. Introduction to java Course Outline 1. Introduction to OO programming 2. Language Basics Syntax and Semantics 3. Algorithms, stepwise refinements. 4. Quiz/Assignment ( 5. Repetitions (for loops) 6. Writing simple classes 7.

More information

Variables and Data Representation

Variables and Data Representation You will recall that a computer program is a set of instructions that tell a computer how to transform a given set of input into a specific output. Any program, procedural, event driven or object oriented

More information

INTRODUCTION TO COMPUTER PROGRAMMING. Richard Pierse. Class 9: Writing Java Applets. Introduction

INTRODUCTION TO COMPUTER PROGRAMMING. Richard Pierse. Class 9: Writing Java Applets. Introduction INTRODUCTION TO COMPUTER PROGRAMMING Richard Pierse Class 9: Writing Java Applets Introduction Applets are Java programs that execute within HTML pages. There are three stages to creating a working Java

More information

Sun ONE Integrated Development Environment

Sun ONE Integrated Development Environment DiveIntoSunONE.fm Page 197 Tuesday, September 24, 2002 8:49 AM 5 Sun ONE Integrated Development Environment Objectives To be able to use Sun ONE to create, compile and execute Java applications and applets.

More information

CSS worksheet. JMC 105 Drake University

CSS worksheet. JMC 105 Drake University CSS worksheet JMC 105 Drake University 1. Download the css-site.zip file from the class blog and expand the files. You ll notice that you have an images folder with three images inside and an index.html

More information

http://java.sun.com/docs/books/tutorial/getstarted/index.html1 Getting Started THIS chapter gives a quick introduction to the Java TM technology. First, we explain what the Java platform is and what it

More information

ORB Education Quality Teaching Resources

ORB Education Quality Teaching Resources These basic resources aim to keep things simple and avoid HTML and CSS completely, whilst helping familiarise students with what can be a daunting interface. The final websites will not demonstrate best

More information

Refreshing Your Affiliate Website

Refreshing Your Affiliate Website Refreshing Your Affiliate Website Executive Director, Pennsylvania Affiliate Your website is the single most important marketing element for getting the word out about your affiliate. Many of our affiliate

More information

Programming Robots with ROS, Morgan Quigley, Brian Gerkey & William D. Smart

Programming Robots with ROS, Morgan Quigley, Brian Gerkey & William D. Smart Programming Robots with ROS, Morgan Quigley, Brian Gerkey & William D. Smart O Reilly December 2015 CHAPTER 23 Using C++ in ROS We chose to use Python for this book for a number of reasons. First, it s

More information

Windows Script Host Fundamentals

Windows Script Host Fundamentals O N E Windows Script Host Fundamentals 1 The Windows Script Host, or WSH for short, is one of the most powerful and useful parts of the Windows operating system. Strangely enough, it is also one of least

More information

The World Wide Web is a technology beast. If you have read this book s

The World Wide Web is a technology beast. If you have read this book s What Is a Markup Language and Why Do I Care? The World Wide Web is a technology beast. If you have read this book s introduction, you should have at least a passing familiarity with how the Web started

More information

GROW YOUR BUSINESS WITH AN ALL-IN-ONE REAL ESTATE PLATFORM

GROW YOUR BUSINESS WITH AN ALL-IN-ONE REAL ESTATE PLATFORM GROW YOUR BUSINESS WITH AN ALL-IN-ONE REAL ESTATE PLATFORM ZipperAgent TABLE OF CONTENTS 1. Introduction: How valuable is your CRM? 2. Online Lead Capture: Online lead capture builds your business 3. Timely

More information

COMP110 Jump Around. Go ahead and get today s code in Eclipse as shown on next few slides. Kris Jordan

COMP110 Jump Around. Go ahead and get today s code in Eclipse as shown on next few slides. Kris Jordan Go ahead and get today s code in Eclipse as shown on next few slides COMP110 Jump Around Fall 2015 Sections 2 & 3 Sitterson 014 November 19th, 2015 Kris Jordan kris@cs.unc.edu Sitterson 238 Classroom Materials

More information

Web API Lab. The next two deliverables you shall write yourself.

Web API Lab. The next two deliverables you shall write yourself. Web API Lab In this lab, you shall produce four deliverables in folder 07_webAPIs. The first two deliverables should be pretty much done for you in the sample code. 1. A server side Web API (named listusersapi.jsp)

More information

T H E I N T E R A C T I V E S H E L L

T H E I N T E R A C T I V E S H E L L 3 T H E I N T E R A C T I V E S H E L L The Analytical Engine has no pretensions whatever to originate anything. It can do whatever we know how to order it to perform. Ada Lovelace, October 1842 Before

More information

CT 229 Arrays in Java

CT 229 Arrays in Java CT 229 Arrays in Java 27/10/2006 CT229 Next Weeks Lecture Cancelled Lectures on Friday 3 rd of Nov Cancelled Lab and Tutorials go ahead as normal Lectures will resume on Friday the 10 th of Nov 27/10/2006

More information

Architectural Documentation 1

Architectural Documentation 1 Architectural Documentation Architectural Documentation 1 The Purpose of Architectural Documentation The documentation shall give the reader good understanding of the application's architecture and design.

More information

CSC System Development with Java Introduction to Java Applets Budditha Hettige

CSC System Development with Java Introduction to Java Applets Budditha Hettige CSC 308 2.0 System Development with Java Introduction to Java Applets Budditha Hettige Department of Statistics and Computer Science What is an applet? applet: a Java program that can be inserted into

More information

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG 1 Notice Reading Assignment Chapter 1: Introduction to Java Programming Homework 1 It is due this coming Sunday

More information

Outline. Turtles. Creating objects. Turtles. Turtles in Java 1/27/2011 TOPIC 3 INTRODUCTION TO PROGRAMMING. Making things to program with.

Outline. Turtles. Creating objects. Turtles. Turtles in Java 1/27/2011 TOPIC 3 INTRODUCTION TO PROGRAMMING. Making things to program with. 1 Outline 2 TOPIC 3 INTRODUCTION TO PROGRAMMING Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared

More information

Get Your Browser into Use Quickly!

Get Your Browser into Use Quickly! by Norma Sollers Using Mozilla Firefox Preface The Internet is a worldwide network of computers linked together. This physically based structure provides different kinds of services which can be used if

More information

Python for Analytics. Python Fundamentals RSI Chapters 1 and 2

Python for Analytics. Python Fundamentals RSI Chapters 1 and 2 Python for Analytics Python Fundamentals RSI Chapters 1 and 2 Learning Objectives Theory: You should be able to explain... General programming terms like source code, interpreter, compiler, object code,

More information

Working with Track Changes: A Guide

Working with Track Changes: A Guide Working with Track Changes: A Guide Prepared by Chris Cameron & Lesley-Anne Longo The Editing Company Working with Track Changes: A Guide While many people may think of editors hunched over their desks,

More information

INFOPOP S UBB.CLASSIC SOFTWARE. User Guide. Infopop Corporation Westlake Avenue North Suite 605 Phone Fax

INFOPOP S UBB.CLASSIC SOFTWARE. User Guide. Infopop Corporation Westlake Avenue North Suite 605 Phone Fax INFOPOP S UBB.CLASSIC SOFTWARE User Guide Infopop Corporation 1700 Westlake Avenue North Suite 605 Phone 206.283.5999 Fax 206.283.6166 Document Last Revised: 6/12/02 (UBB.classic version 6.3.1) Infopop,

More information

UNIT 3 SECTION 1 Answer the following questions Q.1: What is an editor? editor editor Q.2: What do you understand by a web browser?

UNIT 3 SECTION 1 Answer the following questions Q.1: What is an editor? editor editor Q.2: What do you understand by a web browser? UNIT 3 SECTION 1 Answer the following questions Q.1: What is an editor? A 1: A text editor is a program that helps you write plain text (without any formatting) and save it to a file. A good example is

More information

Eclipse Tutorial. For Introduction to Java Programming By Y. Daniel Liang

Eclipse Tutorial. For Introduction to Java Programming By Y. Daniel Liang Eclipse Tutorial For Introduction to Java Programming By Y. Daniel Liang This supplement covers the following topics: Getting Started with Eclipse Choosing a Perspective Creating a Project Creating a Java

More information

Creating a Poster in Google SketchUp

Creating a Poster in Google SketchUp If you have digital image, or can find one online, you can easily make that image into a room poster. For this project, it helps to have some basic knowledge of Google SketchUp (though detailed instructions

More information

THE SET AND FORGET SYSTEM

THE SET AND FORGET SYSTEM THE SET AND FORGET SYSTEM MODULE II SQUEEZE PAGES & SUBSCRIPTION LAYOUT MAKE MONEY WHILE YOU SLEEP! Table Of Contents Introduction Important Steps Squeeze Page Layout & Opt In 5 Essential Build Tips Squeeze

More information

This chapter is intended to take you through the basic steps of using the Visual Basic

This chapter is intended to take you through the basic steps of using the Visual Basic CHAPTER 1 The Basics This chapter is intended to take you through the basic steps of using the Visual Basic Editor window and writing a simple piece of VBA code. It will show you how to use the Visual

More information

Programming Assignment 2 ( 100 Points )

Programming Assignment 2 ( 100 Points ) Programming Assignment 2 ( 100 Points ) Due: Thursday, October 16 by 11:59pm This assignment has two programs: one a Java application that reads user input from the command line (TwoLargest) and one a

More information

Chapter 3 - Introduction to Java Applets

Chapter 3 - Introduction to Java Applets 1 Chapter 3 - Introduction to Java Applets 2 Introduction Applet Program that runs in appletviewer (test utility for applets) Web browser (IE, Communicator) Executes when HTML (Hypertext Markup Language)

More information

Agenda: Notes on Chapter 3. Create a class with constructors and methods.

Agenda: Notes on Chapter 3. Create a class with constructors and methods. Bell Work 9/19/16: How would you call the default constructor for a class called BankAccount? Agenda: Notes on Chapter 3. Create a class with constructors and methods. Objectives: To become familiar with

More information

Dynamism and Detection

Dynamism and Detection 1 Dynamism and Detection c h a p t e r ch01 Page 1 Wednesday, June 23, 1999 2:52 PM IN THIS CHAPTER Project I: Generating Platform-Specific Content Project II: Printing Copyright Information and Last-Modified

More information

A Document Created By Lisa Diner Table of Contents Western Quebec School Board October, 2007

A Document Created By Lisa Diner Table of Contents Western Quebec School Board October, 2007 Table of Contents A Document Created By Lisa Diner Western Quebec School Board October, 2007 Table of Contents Some Basics... 3 Login Instructions... 4 To change your password... 6 Options As You Login...

More information

Intro. Scheme Basics. scm> 5 5. scm>

Intro. Scheme Basics. scm> 5 5. scm> Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if

More information

Reading How the Web Works

Reading How the Web Works Reading 1.3 - How the Web Works By Jonathan Lane Introduction Every so often, you get offered a behind-the-scenes look at the cogs and fan belts behind the action. Today is your lucky day. In this article

More information

Lesson 1: Writing Your First JavaScript

Lesson 1: Writing Your First JavaScript JavaScript 101 1-1 Lesson 1: Writing Your First JavaScript OBJECTIVES: In this lesson you will be taught how to Use the tag Insert JavaScript code in a Web page Hide your JavaScript

More information

Effective Communication in Research Administration

Effective Communication in Research Administration Effective Communication in Research Administration Ianthe Cookie Bryant-Gawthrop Director, Research Regulatory Affairs and Human Research Protection Program 9:30 10:40 and 10:50 12:00 Effective Communication

More information

EXCEL BASICS: MICROSOFT OFFICE 2010

EXCEL BASICS: MICROSOFT OFFICE 2010 EXCEL BASICS: MICROSOFT OFFICE 2010 GETTING STARTED PAGE 02 Prerequisites What You Will Learn USING MICROSOFT EXCEL PAGE 03 Opening Microsoft Excel Microsoft Excel Features Keyboard Review Pointer Shapes

More information

Laboratory 1: Eclipse and Karel the Robot

Laboratory 1: Eclipse and Karel the Robot Math 121: Introduction to Computing Handout #2 Laboratory 1: Eclipse and Karel the Robot Your first laboratory task is to use the Eclipse IDE framework ( integrated development environment, and the d also

More information

CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction

CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics COMP-202 Unit 1: Introduction Announcements Did you miss the first lecture? Come talk to me after class. If you want

More information

Dealer Instructions for the Product Configurator

Dealer Instructions for the Product Configurator Dealer Instructions for the Product Configurator Purpose: By providing you, the dealer, with information about the Product Configurator and the instructions for the use of the Product Configurator it is

More information

Department of Computer Science. Software Usage Guide. CSC132 Programming Principles 2. By Andreas Grondoudis

Department of Computer Science. Software Usage Guide. CSC132 Programming Principles 2. By Andreas Grondoudis Department of Computer Science Software Usage Guide To provide a basic know-how regarding the software to be used for CSC132 Programming Principles 2 By Andreas Grondoudis WHAT SOFTWARE AM I GOING TO NEED/USE?...2

More information

Want to add cool effects like rollovers and pop-up windows?

Want to add cool effects like rollovers and pop-up windows? Chapter 10 Adding Interactivity with Behaviors In This Chapter Adding behaviors to your Web page Creating image rollovers Using the Swap Image behavior Launching a new browser window Editing your behaviors

More information

Campaign Walkthrough

Campaign Walkthrough Email Campaign Walkthrough This guide is distributed with software that includes an end-user agreement, this guide, as well as the software described in it, is furnished under license and may be used or

More information

CPSC 324 Topics in Java Programming

CPSC 324 Topics in Java Programming CPSC 324 Topics in Java Programming Lecture 7 Today Go over quiz Assignment 2 notes Start on basic class inheritance Applets lab Reading assignments Core: Ch. 4: 144-152, 162-169 Core: Ch. 5: 171-182 CPSC

More information

CISC 1600 Lecture 3.1 Introduction to Processing

CISC 1600 Lecture 3.1 Introduction to Processing CISC 1600 Lecture 3.1 Introduction to Processing Topics: Example sketches Drawing functions in Processing Colors in Processing General Processing syntax Processing is for sketching Designed to allow artists

More information

Agenda. Announcements. Extreme Java G Session 2 - Main Theme Java Tools and Software Engineering Techniques

Agenda. Announcements. Extreme Java G Session 2 - Main Theme Java Tools and Software Engineering Techniques Extreme Java G22.3033-007 Session 2 - Main Theme Java Tools and Software Engineering Techniques Dr. Jean-Claude Franchitti New York University Computer Science Department Courant Institute of Mathematical

More information

INTERNET BASICS. GETTING STARTED PAGE 02 Prerequisites What You Will Learn

INTERNET BASICS. GETTING STARTED PAGE 02 Prerequisites What You Will Learn INTERNET BASICS GETTING STARTED PAGE 02 Prerequisites What You Will Learn BASIC WEB SKILLS/USING A WEB BROWSER PAGE 03 Locate and Open a Web Browser Using a Browser s Menu Options Using the Browser s Navigation

More information

Class 1: Homework. Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017

Class 1: Homework. Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017 Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017 1 1. Please obtain a copy of Introduction to Java Programming, 11th (or 10th) Edition, Brief

More information

The NetBeans IDE is a big file --- a minimum of around 30 MB. After you have downloaded the file, simply execute the file to install the software.

The NetBeans IDE is a big file --- a minimum of around 30 MB. After you have downloaded the file, simply execute the file to install the software. Introduction to Netbeans This document is a brief introduction to writing and compiling a program using the NetBeans Integrated Development Environment (IDE). An IDE is a program that automates and makes

More information

FTP Frequently Asked Questions

FTP Frequently Asked Questions Guide to FTP Introduction This manual will guide you through understanding the basics of FTP and file management. Within this manual are step-by-step instructions detailing how to connect to your server,

More information

This is a book about using Visual Basic for Applications (VBA), which is a

This is a book about using Visual Basic for Applications (VBA), which is a 01b_574116 ch01.qxd 7/27/04 9:04 PM Page 9 Chapter 1 Where VBA Fits In In This Chapter Describing Access Discovering VBA Seeing where VBA lurks Understanding how VBA works This is a book about using Visual

More information

Boolean Expressions. Is Equal and Is Not Equal

Boolean Expressions. Is Equal and Is Not Equal 3 MAKING CHOICES ow that we ve covered how to create constants and variables, you re ready to learn how to tell your computer to make choices. This chapter is about controlling the flow of a computer program

More information

C Pointers 2013 Author Riko H i

C Pointers 2013 Author Riko H i http:/cdorm.net/understanding C Pointers 2013 Author Riko H i Copyright 2013 CDorm.net All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form

More information

the NXT-G programming environment

the NXT-G programming environment 2 the NXT-G programming environment This chapter takes a close look at the NXT-G programming environment and presents a few simple programs. The NXT-G programming environment is fairly complex, with lots

More information

Authoring World Wide Web Pages with Dreamweaver

Authoring World Wide Web Pages with Dreamweaver Authoring World Wide Web Pages with Dreamweaver Overview: Now that you have read a little bit about HTML in the textbook, we turn our attention to creating basic web pages using HTML and a WYSIWYG Web

More information

Before & After. Use the Principles Cheatsheet! From The Non-Designer s Design Book, Robin Williams Non-Designer s Design 8

Before & After. Use the Principles Cheatsheet! From The Non-Designer s Design Book, Robin Williams Non-Designer s Design 8 Before & After Use the Principles Cheatsheet! From The Non-Designer s Design Book, Robin Williams Non-Designer s Design 8 Before & After From The Non-Designer s Design Book, Robin Williams Non-Designer

More information

COMS 469: Interactive Media II

COMS 469: Interactive Media II COMS 469: Interactive Media II Agenda Review Data Types & Variables Decisions, Loops, and Functions Review gunkelweb.com/coms469 Review Basic Terminology Computer Languages Interpreted vs. Compiled Client

More information

Computer Concepts for Beginners

Computer Concepts for Beginners Computer Concepts for Beginners Greetings Hi, my name is Tony & we re about to take a big plunge into the computer world! For some of us, this might be the first time we re actually using our computers,

More information

CompClass User Guide for Students The Bedford Handbook, Seventh Edition. Hacker

CompClass User Guide for Students The Bedford Handbook, Seventh Edition. Hacker CompClass User Guide for Students The Bedford Handbook, Seventh Edition Hacker Getting Started with CompClass for The Bedford Handbook, Seventh Edition Table of Contents Overview... 1 Getting Help... 1

More information

COMP 110 Project 1 Programming Project Warm-Up Exercise

COMP 110 Project 1 Programming Project Warm-Up Exercise COMP 110 Project 1 Programming Project Warm-Up Exercise Creating Java Source Files Over the semester, several text editors will be suggested for students to try out. Initially, I suggest you use JGrasp,

More information