p9--Exercises
1. Features of the Java language
(1) Simple and efficient
(2) Object-oriented language
(3) Platform Independence and portability
(4) Stability and safety
(5) Multi-threaded and dynamic
(6) High performance
(7) distributed, "physically distributed, logically unified"
3.Java platform divided into three categories
(1) Java EE (JAVA2 Enterprise Edition) is applicable to enterprises, providing application service operation and development platform for enterprise computing.
(2) J2SE (JAVA2 standard Edition) is suitable for learning and provides development and operational platforms for desktops and workstations.
(3) J2ME (Java2 Micro Edition) is applicable to consumer electronic products (set-top box, mobile phone, PDA, etc.), providing a running platform for consumer electronics products.
4. Output string "My first Java"
(1) Application procedure
Myfirstjava.java
public class Myfirstjava
{
public static void Main (string[] args)
{
System.out.println ("My first java! ");
}
}
(2) Applet program
Myfirstjava.java
Import java.awt.*;
Import java.applet.*;
public class Myfirstjava extends Applet
{
public void Init ()
{}
public void Paint (Graphics g)
{
g.DrawString ("My first java!", 25,25);
}
}
Myfirstjava.html
<applet code= "Myfirstjava" width=150 height=100>
</APPLET>
Issue 1: Enter the Myjava folder access program under the original file path
Workaround: Enter cd+ space + folder + ENTER key
Issue 2: Exit the Myjava folder access program under the original file path
WORKAROUND: Enter the CD. + ENTER
Issue 3: Clear the screen
Workaround: Enter cls+ enter
Issue 4: In a DOS environment, create a new Myjava folder in the root directory and view
Workaround:
(1) New folder: Enter md+ SPACEBAR + folder + ENTER key
(2) Check the file status in the root directory: input dir+ Enter
Issue 5: In a DOS environment, delete the Myjava folder in the root directory and view
Workaround:
(1) New folder: Enter rd+ SPACEBAR + folder + ENTER key
(2) Check the file status in the root directory: input dir+ Enter
5. Merging the applet program in 4 with the application program
Myfirstjava.java
Import java.awt.*;
Import java.applet.*;
public class Myfirstjava extends Applet
{
public void Init ()
{}
public void Paint (Graphics g)
{
g.DrawString ("My first java!", 25,25);
}
public static void Main (String args[])
{
System.out.println ("My first java!");
}
}
Myfirstjava.html
<applet code= "Myfirstjava" width=150 height=100>
</APPLET>
Chapter One first contact with Java