. : , public class myTop { public static void main (String args[]){ int argc = args.length; for (int i = 0; i < argc; i++) System.out.println (argc[i]); } } Applet: public void init () ; public void start (); ; public void stop (); , Web-; public void destroy (); ; , ; stop(); . : 1 import java.awt.Graphics; 2 import java.applet.Applet; 3 class SimpleApplet extends Applet { 4 public void paint (Graphics g) { 5 g.drawString ("Hello world!", 10, 10); 6 } 7 } public void paint (Graphics g) ( 4-6) , , - WWW- . WWW- . HTML 2.0 . - , . WWW- - , . WWW-.

, Java

WWW- , , Java, -------------------------------------------------------------------------- , Java -------------------------------------------------------------------------- , , : public void init () { String fontname = getParameter ("name"); String fontSizestring = getParameter ("size"); int theSize = Int.parseInt (fontSizeString); . . . }  4.2.2. Java- Java- Java- Java-. , Java- - , - , - , - - . , Java-. , , . - P- - -; ; - -, . Java - , Java- -- . , , Java-. Web- Java-, - . , , Java- ; . , - Java- , . , Java- (- ), () . , Java-, -. Java- . 1.0.  4.2.2.1. , Java- Java- : - byte - ; - short - ; - int - ; - long - ; - float - IEEE-754; - double - ; - char - Unicode. Java- , - . , . , iadd, - dadd. boolean - . : - object - ( ); - returnAddress - . Java- - . Sun Microsystems object - , - . . Java- 32-. (long, double) . , ; , - , "" .  4.2.2.2.  Java- : - pc - ; , . - vars - - . - optop - . Java- - , . - frame - , . , : , - . , - - . - ( ). - . . Java- catch, . - , , , , Java- .  4.2.2.3.  . Java , , . , - Java-.  4.2.2.4. Java- Java- , ( ). : - . . , dload , , , aload . - . - . , newarray , , , . , - - , anewarray. Java-. - . , , , , , - . - . ; . - (, , , ). - . - . , jsr ( ) ; , jsr, . . - . . - , breakpoint, - - . - (/- / ). - . . invokevirtual - () . invokenonvirtual - - , - . invokestatic . , invokeinterface , . - , . - - athrow. - ( , - ). - ( , ). , Java Java-. , - Java- .  4.2.3. Java  , . - Java-, Web- - . , Java . , goto "". , .. - , , , . , , "" - . - - , , , Java-. , , , , , , . , - ( UNIX, fork exec), , - Java-. , Java- . , Netscape Navigator 2.0 . , JDK 1.0 Sun Microsystems , - . , : - ; - // ; - ; - - , , . JDK , - ~/.hotjava/properties acl.read=/home/welcome acl.write=/tmp - -. , - , , , , - , .. . finally - . , . , , Argus System Group, , "- " . , , - Java-. , - , Java.  4.2.4. Java WorkShop 1996 Sun Microsystems 1.0 Java WorkShop. : - Java , Web-. . y1 Java WorkShop. . y1. Java WorkShop. , , - , . - , , , . , . Java WorkShop , , , , - . : - - , - , . - - . - , .. - - . , - Web- - , , . - - Java-. - - . - . Java WorkShop, - . - . , Java WorkShop , Java-. y2 . . y2. Java WorkShop. - . Java WorkShop SPARC/Solaris Intel/Solaris, Microsoft Windows 95/NT. - - Java WorkShop . - 45 , 32 ( Solaris) 16 ( Windows) . , - .  * 4.3. Java :   4.3.1.  Java , , - - . , Java - . . ( - ) , - ( ) . - - . - , . , - , - , - . Motif MS-Windows Macintosh. - - , - , - .. , - . - , - - , , , , , , , - . , , " - ", " " .. , -- - - , - . , , - - , "" . MFC, OWL, Zink . Java- AWT Abstract Windowing Toolkit - - . AWT . "" , , , - . AWT , , , ; - - , , . . x1. . x1. AWT. , Peer. AWT, . - - Java.  4.3.2. (  ) , , , . AWT ( Component), - . - , - , . , - . . x2. ( Charles L. Perkins, clp@home.HarvardSq.com.) . x2. AWT . x3 , . x2. : - Button - Checkbox - Label - List - ScrollBar - TextArea - TextField : - Dialog - FileDialog - Frame - Panel - Window - , - .  4.3.3.  , , . , , - . (, , ) - . , , - (, - , " "). - , - , - . AWT . , . Layout (). Layout , , . AWT 5 : - BorderLayout - CardLayout - FlowLayout - GridLayout - GridBagLayout . x4. . x4. AWT. Object LayoutManager. LayoutManager Container. Container 3 add, . - add, LayoutManager . LayoutManager setLayout. , - .  4.3.3.1. BorderLayout BorderLayout 5 : , , , : [Image] - add (string, component); . setLayout (new BorderLayout()); buttonN = new Button ("one"); add ("North", buttonN); // ...  4.3.3.2. CardLayout [Image] . - . , CardLayout - . C . : add (string, component); string - "", component - - . , ( - ): setLayout (new CardLayout ()); add ("one", create (new FlowLayout ())); add ("two", create (new BorderLayout ())); add ("three", create (new GridLayout (2, 2))); add ("four", create (new BorderLayout (10, 10))); add ("five", create (new FlowLayout (FlowLayout.LEFT, 10, 10))); add ("six", create (new GridLayout (2, 2, 10, 10)));  4.3.3.3. FlowLayout FlowLayout . . - . [Image] setLayout (new FlowLayout ()); add (new Button ("OK")); add (new Button ("Cancel")); add (new Button ("Resume")); add (component). , , - .  4.3.3.4. GridLayout . . , . . add (component) [Image] . setLayout (new GridLayout (2, 3)); // 2 , 3 add (new Button ("1")); add (new Button ("2")); add (new Button ("3")); add (new Button ("I")); add (new Button ("II"));  4.3.3.5. GridBagLayout GridBagLayout - . . , GridBagLayout . GridBagConstraints. 10 , - . , GridBagConstraints, : GridBagLayout gridbag = new GridBagLayout (); GridBagConstraints c = new GridBagConstraints (); setLayout (gridbag); // c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; . . . Button button1 = new Button ("1"); gridbag.setConstraints (button1, c); add (button1); . . . // // GridBagConstraints, // // c.fill = GridBagConstraints.NONE; Button buttonX= new Button ("X"); gridbag.setConstraints (buttonX, c); add (buttonX);  4.3.4.  AWT, , . - - , AWT ACTION_EVENT. , AWT , . , - . , AWT. (, ) . , - (, ), - handleEvent. , , , - (, ). , , - ( ) . . - -, , . - -, - , handleEvent. . - , . - handleEvent , - - (, - ). , , - . "The Command Class for AWT objects", - Jan Newmarch, jan@ise.canberra.edu.au.  4.3.5. Component,  Component, - . - postEvent(). , , - . - handleEvent(). , , , - - action() - - keyUp() - - mouseDown() - - gotFocus() .. handleEvent() . , , - , , handleEvent() - false, handleEvent() , - . AWT Event, : public Object target; // public long when; // , public int id; // (KEY_PRESS, MOUSE_DOWN...) public int x; // public int y; // public int key; // public int modifiers;// (control, shift ...) public Object arg; // public Event evt; // , - ( - ). class MyApplet extends Applet { . . . public boolean action( Event evt, Object arg) { . . . if ((ev.target instanceof Button) && arg.equals ("OK")) { // . . . return true; } else { // . . . } . . . return false; } . . . } , Button - "OK", - true, . - . . class OKButton extends Button { . . . public boolean action (Event e, Object arg) { // . . . return true; } } , Java . - . 5. Joe - Java- - , "Java, Joe NEO", , SunSoft - Joe - , Java, , NEO. Joe ( ) - , , - Java- - . Jet Info "- ". . Java - , . 1 import java.awt.Font; 2 import java.awt.Color; 3 public class JAVAhello extends java.applet.Applet { 4 Font f = new Font ("TimesRoman", Font.BOLD, 36); 5 public void init () { 6 resize (150, 25); 7 } 8 public void paint (Graphics g) { 9 g.setFont (f); 10 g.setColor (Color.blue); 11 g.drawString ("Hello, World!", 50, 25); 12 } 13 } Joe, - /. 1 import sunw.services.*; 2 import java.awt.Graphics; 3 import java.awt.Font; 4 import java.awt.Color; 5 public class JOEhello extends sunw.services.JOEApplet { 6 sunw.corba.ObjectRef obj; 7 Hello.HelloWorldRef hiThere; 8 Font f = new Font("TimesRoman", Font.BOLD, 36); 9 public void init () { 10 super.init (); 11 resize (150, 25); 12 obj = find ("HelloWorldServer"); 13 hiThere = Hello.HelloWorldStub.narrow (obj); 14 } 15 public void paint (Graphics g) { 16 g.setFont (f); 17 g.setColor (Color.red); // , C++, // . 18 g.drawString (hiThere.sayHello (), 50, 25); 19 } 20 } , - . 1 . 5 , Hello JOEApplet. 6 ( ) NEO-. . 7 NEO-, ( , ) Java. 12 NEO . 13 . , 18 - , , , Java (, C++). , - , . Joe . - : - NEO-, IDL (Interface Definition Language), Java. Joe IDL - Java. , , . , , Joe, - WWW- Java-. - Java Joe . Java- - . , - , . , -. Joe Java- IDL-. 6.  Java - , - . - - , . , - - - . Java Web-, - -. Java - - - . - , - . Sun Microsystems - Joe NEO - Java , - . ------------------ , . , 1993 , Sun Microsystems. Java, Java, - Java- Java. 1996 Java. Java, - 1996 "Hooked on Java". . Internet, Web Java . - Java, - , , - , , Java - . - , - Internet, , Java- .. - . , , - ? . , Java Internet , , . , , . , Java Internet , . , . Java Internet? , - , : - . . , Java - . , , Java (, - )? Java? . , , Java, . , - , . - , , - . , , Java, , Java, ? . , Internet, Web Java, (IBM, Sun, HP, DEC, Compaq, Oracle - )? . - . - . - Java, , , , Microsoft, . - , , , , - . . , , - , - . , " " 80- . - , - . - , Java " ",