Non-professional Code Nong Java Learning Note 1

Source: Internet
Author: User

Unconsciously, the project needs, have learned Java this abstruse thing. C # Review, also in the same period, but because of the project needs, we still slowly C # bar. Today is just a casual look at Java. Say less, take notes

Java language and object-oriented Programming (second edition)

I. Overview of object-oriented software development

(a) The software development process for the sexual orientation:

    1. Analyze user requirements and extract object models from them
    2. Refine the model, design the class, including the relationship between classes and classes, and see if a molded class is available for reference
    3. Select a language for research and development
    4. Test

(ii) The advantages of object-oriented programming

1. Re-usability

2. Extensibility

3. Manageability

Ii. Overview of Java

(i) Java development environment

1. Platform classification: Javase,standardedition Standard Edition; Java EE Enterprise Edition; javame, mobile device edition

2.JDK command

Javac file name: the. Java output to a. class file

Java class file name: Run Program

Appletviewer Running applet applets

Jar file name Class Name 1 class Name 2 ... : Composite jar file with multiple. class files

3.java Program Categories:

Java application-complete Java program

Non-standalone programs running on the Java applet-html page

4.java program Run

(1) Environment construction: Installation JAVASDK

(2) Configuring environment variables-right-click My Computer-Properties-Advanced system settings-environment variables

"Environment variable (s)", New-Name "Java_home", Value: "Javasdk path/java1.6.0", Path variable (usually, no self-built bar), add "%java_home%/bin;%java_home%/jar/bin;"

(3) Test: Run-cmd:javac, no hint no this command is successful.

(4) Program execution steps:

CMD: Find the path of the Java file, command: C path;

Javac file path/file name. extension//Compile file, generate class file

The class name within the Java file

(ii) Examples of procedures

1.javaapplication (slightly), standalone Java program

2.javaapplet-Java programs that embed other platforms and files

It's common to embed Java in HTML

Myapplet.java

Import Java.awt.Grathics;

Import Java.applet.Applet;

public class Myjavaapplet extends applets//general Javaapplet need to inherit from other classes, either system classes or other classes that can be user-defined

{

public void Pain (grphics g)//This is because it inherits other Java, so it doesn't need the main method

{

g.DrawString ("Hellow,java APPLWT World", 10,20);

}

}

In HTML pages, use <applet code= ".... Class" height= width=></applet> Note that the class file is a. java file that is parsed using the Javac command.

Run the process if prompted to block, it is in the Control Panel-the program-java panel, adjust the security settings to medium can be

(iii), the input and output of the graphical interface

After two process understanding, the interface output and input should have the following points

The addition of methods and events is usually set up with a ActionListener, which will add implement when defining the class ActionListener

L just like C #, each control is an object that can be instantiated and then added to somewhere: textfiled A;

L ADD (a);//or This.add (a);

L get something on a control, GetText (control name); assignment, SetText (control name)

Non-professional Code Nong Java Learning Note 1

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.