Introduction to Java Programming CS 21a: Introduction to Computing I Department of Information Systems and Computer Science Ateneo de Manila University.

Slides:



Advertisements
Similar presentations
A Programmer's Introduction to Java - from a S/370 user (c) IDMS/SQL News
Advertisements

ASP.NET Intro An introduction to the languages and communication of an ASP.NET system.
In Review JAVA C++ GUIs - Windows Webopedia.com.
Java: History and Introduction (Lecture # 1). History… Java – Based on C and C++ – Developed in 1991 for intelligent consumer electronic devices – Green.
Introduction to Java Kiyeol Ryu Java Programming Language.
Aalborg Media Lab 18-Jun-15 Introduction Introduction to System Design I Fall 2004.
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.
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,
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved COS240 Object-Oriented Languages.
WWW and Internet The Internet Creation of the Web Languages for document description Active web pages.
Applets, HTML and GUI’s Recitation – 04/11/2008 CS 180 Department of Computer Science, Purdue University.
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
Developing User Interfaces (DUI) Chris North cs3724: HCI.
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 First Semester,
CSE 452: Programming Languages Java and its Evolution.
Java Workshop for Teachers May 6, 2005 A Brief Look at the Java Programming Language.
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.
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.
Applets Chapter 17.  Java’s big splash onto the scene came in the mid 90’s. The people at Sun Microsystems had managed to work java programs into Web.
Introduction to Object-Oriented Programming
Applets and Frames CS 21a: Introduction to Computing I First Semester,
Sadegh Aliakbary Sharif University of Technology Fall 2012.
Chapter 17: Applets, Images, and Sound. Objectives Learn about applets Write an HTML document to host an applet Use the init() method Work with JApplet.
Introduction to Java and Object-Oriented Programming AJSS Computer Camp Department of Information Systems and Computer Science Ateneo de Manila University.
1 Part I : Chapter 01 Introduction to Java Programming.
1 Computer Systems -- Introduction  Chapter 1 focuses on:  the structure of a Java application  basic program elements  preparing and executing a program.
Java Applets. 2 Introduction to Java Applet Programs  Applications are stand alone programs executed with Java interpreter executed with Java interpreter.
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Clement Allen, PhD Florida A&M University SUMMER 2006.
1 Programming Fundamentals AITI-GP. 2 Introduction to Programming.
IDEs Department of Information Systems and Computer Science Ateneo de Manila University.
The Joy of Programming (also known as) Introduction to Object-Oriented Programming.
An Introduction to Software Development Java Methods A & AB Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin Copyright © 2006.
Introduction to Java Applets Sangeetha Parthasarathy 05/21/2001.
Intro to Applets August 19, 2008 Mrs. C. Furman. Java Applets vs. Java Applications Java Applet: a program that is intended for use on the web. Java Applet:
Applets. What is an applet? Why create applets instead of applications? – Applets are Java programs that can be embedded in an HTML document – In contrast,
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
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved COS240 O-O Languages AUBG,
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
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.
DOS and the Command Line CS 21a: Introduction to Computing I Department of Information Systems and Computer Science Ateneo de Manila University.
Applets and Frames. Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved L14: GUI Slide 2 Applets Usually.
J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition Second Edition D.S. Malik D.S. Malik.
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.
Java -- A very Hot Object- Oriented Language Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of.
Introduction to Programming. The Programming Process Create/Edit Program Compile Program Execute Program Compile Errors?Run-Time Errors? Source Program.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
CSI 3125, Preliminaries, page 1 Applet. CSI 3125, Preliminaries, page 2 Applet An applet is a Java program that runs in a Web browser. An applet can be.
Java Computer Industry Lab. 1 Programming Java Java Basics Incheon Paik.
Computer Science A 1. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated editor,
Applets. 9/04/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved L12: Applets Slide 2 Applets Usually.
Execution ways of program References: www. en.wikipedia.org/wiki/Integrated_development_environment  You can execute or run a simple java program with.
1 Applets Programming. Introduction Java programs are divided into two main categories, applets and applications. An application is an ordinary Java program.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 15: Java Basics Fundamentals of Web Programming.
Introduction to 1. What is Java ? Sun Microsystems Java is a programming language and computing platform first released by Sun Microsystems in The.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
Introduction to.
Advanced Programming Fall 2017.
Java Applets.
Introduction CSC 111.
Debugging Exercise 00 Try compiling the code samples.
Outline Character Strings Variables and Assignment
A Brief History January 1996: first official release JDK 1.0
Presentation transcript:

Introduction to Java Programming CS 21a: Introduction to Computing I Department of Information Systems and Computer Science Ateneo de Manila University

Copyright 2008, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1: Intro Java Slide 2 Programming Recall that a program is defined as: a sequence of instructions for a computer A large part (but not all) of CS 21a is about how to write programs in a programming language (Java)

Copyright 2008, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1: Intro Java Slide 3 The Java Programming Language Java: an object-oriented programming language that is simple safe platform independent designed for the internet Many universities use Java as the introductory programming language for beginning programmers Ateneo adopted Java for CS 21a in 1997

Copyright 2008, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1: Intro Java Slide 4 Java (a brief history) 1991 Sun Microsystems develops a language (based on C) for consumer electronic devices 1993 WWW explodes in popularity increased need for “dynamic” Web pages 1995 Sun formally announces Java for web use

Copyright 2008, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1: Intro Java Slide 5 Two types of Java programs: Applications general-purpose programs standalone executed through the operating system Applets programs meant for the WWW embedded in a Web page normally executed through a browser

Copyright 2008, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1: Intro Java Slide 6 Simple Java Application File: Hello.java // Hello World application public class Hello { public static void main( String args[] ) { System.out.println( “Hello world” ); }

Copyright 2008, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1: Intro Java Slide 7 The Programming Process Create/Edit Program Compile Program Execute Program Compile Errors?Run-Time Errors? Source Program Object Program

Copyright 2008, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1: Intro Java Slide 8 Creation, Compilation, and Execution Create Java program C:\> edit Hello.java Hello.java file is created Compile using javac (compiler) C:\> javac Hello.java Hello.class file is produced Execute using java (interpreter) C:\>java Hello requires a Hello.class file

Copyright 2008, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1: Intro Java Slide 9 Simple Java Applet File: HelloAgain.java import javax.swing.*; import java.awt.*; public class HelloAgain extends JApplet { public void paint( Graphics g ) { g.drawString( “Hello”, 50, 50 ); }

Copyright 2008, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1: Intro Java Slide 10 Executing Applets After compiling the java program: Embed an “applet tag” in an.html document that references the.class file Open the.html document using a browser or the appletviewer

Copyright 2008, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1: Intro Java Slide 11 Sample.html Document File: HA.html My Sample Applet

Copyright 2008, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1: Intro Java Slide 12 What is HTML? Hypertext Markup Language Underlying language of Web pages A means of providing formatting instructions for presenting content Text-based.html documents: collection of content and controls (tags)

Copyright 2008, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1: Intro Java Slide 13 Java Program Structure Java Program (optional) import declarations class declaration Class class name should match its file name may extend an existing class (such as JApplet) contains method/function declarations