Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Programming Software Applications Week 1 Dr. Xiaohong Gao Trent Park – B107, ext. 2252 [email protected] Course Objectives (1/2) Upon completing the course, you will understand : • Java applications • Primitive data types • Java control flow • Methods • Object-oriented programming • Inheritance • Polymorphism • Core Java classes (Swing) • Graphics Course Objectives (2/2) You will be able to : Write applications Develop a simple GUI interface Write interesting projects Establish a firm foundation on Java concepts Learning Patterns • Lecturer(1.5 hours): theory with sample programs • Labs (1.5 hours) : Practice theory using Java programs • Workshops/seminars: discussion/reflection Assessment Pattern • Exam (3 hours) Course work ---- 70 ---- 30% 2 Mini-tasks Project 10% 20% Note: You have to pass both coursework and exam in order to pass the module. Contact Information • Duty tutor time » Friday, 12:30-13:30, Bevan Building • Email [email protected] • Learning Materials http://www.cs.mdx.ac.uk/staffpages/xiaohong/cmt4001 Introduction to Java Objectives What Is Java? • Getting Started With Java Programming • Compiling and Running a Java Application • Compiling and Running a Java Applet Example 1 --- Using TextPad 2. File New 3. File Save As Hello1.java 3. Tools Compile Java 4. Tools Run Java Application What Is Java? • History • Characteristics of Java History • James Gosling Oak • Java, May 20, 1995, Sun World • HotJava – The first Java-enabled Web browser Characteristics of Java • Java is simple • Java is object-oriented • Java is distributed • Java is interpreted • Java is robust • Java is secure Characteristics of Java • Java is architectural-neutral • Java is portable • Java’s performance • Java is multithreaded • Java is dynamic JDK Versions • JDK 1.02 (1995) • JDK 1.1 (1996) • Java 2 SDK v 1.2 (a.k.a JDK 1.2, 1998) • Java 2 SDK v 1.3 (a.k.a JDK 1.2, 2000) • Java 2 SDK v 1.4 Java IDE Tools • Inprise JBuilder (RAD) (www.inprise.com) • Microsoft Visual J++ (www.microsoft.com) • Visual Café by WebGain (www.webgain.com) • JFactory by Rouge Wave (www.rougewave.com) • Forte by Sun (www.javasoft.com) • IBM Visual Age for Java (RAD) (www.ibm.com) Getting Started with Java Programming • A Simple Java Application Compiling Programs Executing Applications • A Simple Java Applet Viewing Java Applets • Applications vs. Applets A Simple Application Example: //This application program prints Welcome //to Java! public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } Compiling Programs • On command line – javac file.java Java Source File Compiler Bytecode Executing Applications • On command line – java classname Bytecode Java Interpreter on Windows Java Interpreter on Linux ... Java Interpreter on Sun Solaris Example javac Welcome.java java Welcome output:... A Simple Applet (Optional) Example /* This is an example of Java applets */ import java.awt.Graphics; public class WelcomeApplet extends java.applet.Applet { public void paint (Graphics g) { g.drawString("Welcome to Java!",10,10); } } Creating an HTML File <html> <body> <applet code="WelcomeApplet.class" width = 100 height = 40> </applet> </body> </html> Viewing Java Applets Applet Browser with Java Interpretation on Sun Browser with Java Interpretation on Windows Applet Viewer Utility appletviewer htmlfile.html Example: appletviewer WelcomeApplet.html Applications vs. Applets • Similarities • Differences Security Restrictions on Applets • Applets are not allowed to read from, or write to, the file system of the computer viewing the applets. • Applets are not allowed to run any programs on the browser’s computer. • Applets are not allowed to establish connections between the user’s computer and another computer except with the server where the applets are stored. Java books • Dietel & Dietel “Advanced Java 2 Platform -How to program” Prentice Hall,last edition •Judith Bishop “Java Gently,Third edition,Addison-Wesley” Summary • Introduction to the module • Java characteristics