Chapter One first contact with Java

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.