Question? Leave a message!




Java applets

Java applets 15
GraceRogers Profile Pic
GraceRogers,Greece,Professional
Published Date:12-07-2017
Website URL
Comment
Java applets SwIG Jing He Outline  What is Java?  Java Applications  Java Applets  Java Applets Securities  SummaryWhat is Java?  Java was conceived by James Gosling at Sun Microsystems Inc. in 1991  Java is platform independent language  Java programming is a/an object-oriented programming. Object oriented language The world around us consists of objects. e.g. the ATMObject oriented language The world around us consists of objects. Let the program consist of objects.Object oriented language The program consist of objects. Objects of the same kind form a class. E.g. class ATM or class Money.Object oriented language The program consist of objects. Objects of the same kind form a class. Each object has some methods. Money withdrawMoney(ATMCard card,int amount) (Objects in the same class have the same methods.)Object oriented language A method of the ATM class: parameters Money withdrawMoney(ATMCard card,int amount) type of return value name of the type of the parameter parameter myPurse.addMoney(theATM. withdrawMoney(myATMCard,1000));Object oriented language more ideas borrowed from the real world: encapsulation – you do not need to know how the ATM works inside. inheritance – you can easily create class ATMWithClocks extending class ATM. The new class inherits the methods of the ATM class.Java Architecture source code JVM Compiler byte code Computer programmer userportability security Java Architecure source code JVM Compiler Computer byte code speed programmer userWhy Java? • simple • portable • secure • free • slowSo What’s Java Good For? Web applications Java Applet Java Applet ServerLearning Java book, lectures • language • libraries documentation http://java.sun.com/docs/ examples on the web (problem – often old version of Java)How are Java Applications written?  HelloWorld.java: public class HelloWorld public static void main (String args) System.out.println(“Hello, World”);  Compile HelloWorld.java javac HelloWorld.java Output: HelloWorld.class  Run java HelloWorld 15 Output: Hello, WorldBuilding JAVA Application  Prepare the file HelloWorld.java using an editor  Invoke the compiler: javac HelloWorld.java  This creates HelloWorld.class  Run the java interpreter: java HelloWorldWhat is an applet?PIG PIGLETAPPLE APPLETWhat is an applet?  An applet is a small Java program that is embedded and ran in some other Java interpreter program such as  a Java technology-enabled browser  Sun’s applet viewer program called appletviewer