Java Workshop for Teachers May 6, 2005 A Brief Look at the Java Programming Language.

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

Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
Client Side Programming Using Java Applet Outcomes: You will be expected to know: – Java Applets and HTML file; –bytecode and platform independent programs;
Introduction to Java Kiyeol Ryu Java Programming Language.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 3 - Introduction to Java Applets Outline 3.1 Introduction 3.2 Sample Applets from the Java 2.
Introduction to Java Programming, 4E
Java Applets. Road Map Introduction to Java Applets Review applets that ship with JDK Make our own simple applets –Introduce inheritance –Introduce the.
Slide 1 of 40. Lecture A The Java Programming Language Invented 1995 by James Gosling at Sun Microsystems. Based on previous languages: C, C++, Objective-C,
Programming Software Applications Week 1 Dr. Xiaohong Gao Trent Park – B107, ext. 2252
L EC. 01: J AVA FUNDAMENTALS Fall Java Programming.
01 Introduction to Java Technology. 2 Contents History of Java What is Java? Java Platforms Java Virtual Machine (JVM) Java Development Kit (JDK) Benefits.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
Getting Started What is Java? A programming language –Fully buzzword-compliant: A simple, object oriented, distributed, interpreted, robust, secure,
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.
BASIC JAVA PROGRAMMING TUTORIAL. History  James Gosling and Sun Microsystems  Oak  Java, May 20, 1995, Sun World  Hot Java –The first Java-enabled.
Introduction to Java Programming CS 21a: Introduction to Computing I Department of Information Systems and Computer Science Ateneo de Manila University.
Introduction to Java Programming with JBuilder 4
Introduction to Java Programming CS 21a: Introduction to Computing I First Semester,
+ Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming.
S.W. Ma/CIM/LWL41211/2 Prog. IIA Page 1 HKIVE (Lee Wai Lee Campus) Department of CIM Course : Year 2 Module : Programming IIA Textbook : Introduction.
CSE 452: Programming Languages Java and its Evolution.
Sadegh Aliakbary Sharif University of Technology Spring 2011.
Sadegh Aliakbary. Copyright ©2014 JAVACUP.IRJAVACUP.IR All rights reserved. Redistribution of JAVACUP contents is not prohibited if JAVACUP.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
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.
Java Lecture 16: Dolores Zage. WWW n Was a method for distributing passive information n added forms and image maps n interaction was only a new way to.
Introduction to Computers and Java Chapter 1.3. A Sip of Java: Outline History of the Java Language Applets A First Java Program Compiling a Java Program.
Sadegh Aliakbary Sharif University of Technology Fall 2012.
1 Part I : Chapter 01 Introduction to Java Programming.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Java Applets. 2 Introduction to Java Applet Programs  Applications are stand alone programs executed with Java interpreter executed with Java interpreter.
OOP (Java): Simple/ OOP (Java) Objectives – –give some simple examples of Java applications and one applet 2. Simple Java Programs Semester.
Java ACO101: Introduction to Computer Science. The History of Java Started out as a research project at Sun Microsystems in 1991 Code named “Green” Based.
May 9, 2002Serguei A. Mokhov, 1 Kickstart Intro to Java Part I COMP346/ Operating Systems Revision 1.6 February 9, 2004.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
Jaeki Song ISQS6337 JAVA Lecture 03 Introduction to Java -The First Java Application-
© 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
Introduction to Java Programming with Forte Y. Daniel Liang.
Clement Allen, PhD Florida A&M University SUMMER 2006.
1 Programming Fundamentals AITI-GP. 2 Introduction to Programming.
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 Programming Lecture 1 Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University
What Is Java? According to Sun in a white paper: Java: A simple, object-oriented, network-savvy, interpreted, robust, secure, architecture-neutral, portable,
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
SOFTWARE TECHNOLOGY - I JAVA/OOP Wickramanayake HMKSK Department of Electrical & Electronic Engineering Faculty of Engineering University.
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.
Intro to Applets. Applet Applets run within the Web browser environment Applets bring dynamic interaction and live animation to an otherwise static HTML.
Lecture 1. Introduction to Programming and Java MIT- AITI 2003.
Application Architecture Using Java Hong Li. Introduction Developed by a team led by James Gosling at Sun Microsystem. Originally called Oak, designed.
Introduction Mehdi Einali Advanced Programming in Java 1.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
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.
Introduction to Java Programming. 2 Chapter 1 Introduction to Java and Forte F What Is Java? F Getting Started With Java Programming –Create, Compile.
ITP 109 Week 2 Trina Gregory Introduction to Java.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 15: Java Basics Fundamentals of Web Programming.
Introduction to Java Programming, 4E Y. Daniel Liang.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Fundamental of Java Programming (630002) Unit – 1 Introduction to Java.
Chapter 1 Introduction to Computers, Programs, and Java
Chapter No. : 1 Introduction to Java.
What is Java? A programming language Fully buzzword-compliant:
Advanced Programming Fall 2017.
Java Applets.
Introduction to Java Brief history of Java Sample Java Program
Java Evolution Java History. Java Features.
Introducing Java.
Outcome of the Lecture Upon completion of this lecture you will be able to understand Fundamentals and Characteristics of Java Language Basic Terminology.
Presentation transcript:

Java Workshop for Teachers May 6, 2005 A Brief Look at the Java Programming Language

What Java Is and Is Not  Java is a full-fledged, powerful and very versatile object-oriented programming language.  Java is a “sequel” to C++ and a “prequel” to Microsoft’s C #.  Java is not Javascript.

How is Java like and unlike what you may already know?  Syntax is very similar to C and C++  Must deal with classes from the beginning  Can write stand-alone programs (old- fashioned console, as well as new-fangled GUI) and also “applets” that run via HTML pages on the WWW  A platform-dependent java compiler produces a file of platform-independent “bytecodes” that are then interpreted by a platform- dependent java interpreter

Early History of Java  Started at Sun Microsystems (1990/91)  James Gosling headed development team  Began life as ‘oak’, was later renamed ‘Java’  Designed for consumer electronic products  First Person, Inc. lost Time-Warner contract  Also worked well for internet programming  Java and HotJava (Web browser) formally announced (Sun World ’95, May 23 in San F)

Version History of Java  Java 1.0 (1995) 212 classes in 8 packages  Java 1.1 (1997) 504 classes in 23 packages  Java 1.2 (1998) 1520 classes in 59 packages  Java 1.3 (2000) 1842 classes in 76 packages  Java 1.4 (2002) 2991 classes in 135 packages  Java 5.0 (2004) 3270 classes in ? packages Java 5.0 contains the first major changes in the language itself since version 1.1.

Java Language Features  object-oriented  simple  distributed  interpreted  robust  secure  architecture neutral  portable  high performance  multithreaded  dynamic

//HelloWorld.java public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, world!"); } $ javac HelloWorld.java The above command produces HelloWorld.class, which is then interpreted by the following command: $ java HelloWorld The Java “Hello, world!” Program

Some Hands-On Experience A couple of console applications: WelcomeConApp.java ConsoleWelcome.java and ConsoleWelcomeTest.java A GUI application: WelcomeGUIApp.java An applet: WelcomeApplet.java and WelcomeApplet.html

WelcomeConApp.java A typical single-file “console program”, with text output to a “console window” (also called “the screen” or “the standard output”) Compile it with the command $ javac WelcomeConApp.java Confirm that you got a file called WelcomeConApp.class Run that.class file with the command $ java WelcomeConApp

ConsoleWelcome.java and ConsoleWelcomeTest.java A typical, but very small, multi-file Java program (only two files) Consists of a class file capable of producing objects of that class, plus another “driver class” that creates and uses an object of the first class Compile both files with the single command $ javac ConsoleWelcomeTest.java Run the program with the command $ java ConsoleWelcomeTest

WelcomeGUIApp.java A small GUI application program, illustrating - programmer color choices - programmer font selection - programmer choice of window size - programmer placement of text in the window This is again a single-file program, but a later practice exercise asks you to convert it to a two-file program (and make some other changes as well).

Java Applets vs. Java Applications An applet is not a standalone program, but instead runs within a web browser An applet must be run via an HTML file which refers to the applet’s class file in an applet tag An applet can also be run by a utility called appletviewer that comes with the JDK (Java Development Kit), just like javac and java appletviewer just shows the applet and ignores any HTML code in the HTML file Applications have a main function, applets don’t

WelcomeApplet.java and WelcomeApplet.html WelcomeApplet.java shows the order in which three of the “built-in” methods of an applet are called: init() is called to do whatever needs doing once start() is called after init() and at each “restart” paint() is called to draw the Graphics object WelcomeApplet.html contains an element that refers to the applet-containing file WelcomeApplet.class which is loaded and run by the browser

Follow-Up Practice Exercises Convert WelcomeConsoleTest.java to use the first two “command-line parameters” as the text of the welcome message and the date. Convert WelcomeGUIApp.java to a two-file program and choose another font, color scheme, and message. Revise WelcomeApplet.java so that the following command will run the applet: $ appletviewer WelcomeApplet.java (assuming WelcomeApplet.class is available)

StudentMarks1.java to StudentMarks6.java A sequence of programs to illustrate incremental program development Get something that works and does a “small version” of what your ultimate goal program will do With each “iteration” add one or more new features that take you toward that goal This kind of program development is closer to the modern “extreme programming” approach than to the older “structured programming”

Some of the things you will see in the StudentMarks*.java sequence Building a GUI interface with buttons and an area to display text Reading input from a file of text Exception handling Event handling Use of a “comparator” to change the “natural” order of a list of strings Generic programming (a brand new feature in Java 5.0)

SplashScreen.java A “fun” application to promote Java Shows how to position your application in the middle of the screen independently of the screen resolution Uses randomly generated values Uses the sleep() method of the Thread class to generate a short delay Uses a “keyboard listener” to terminate the program