It 18 Palm Palm Seventh Day Course Summary

Source: Internet
Author: User

Finish the seventh day of it 18 Palm Java Foundation Course today:

Learning content:

1, review polymorphism, abstract class and interface similarities and differences, adapter mode

2, Anonymous inner class

New Interfacedemo () {concrete method implementation};

3, exception

--------------------------------

Throwable

|---Error

|---Exception

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>

Example: RuntimeException run-time exception

GetMessage ()

ToString () method

Printstacktrace () print stack tracking information;

Example:

Throws: Declaring an exception type after a function name

Throw: Throws an exception object inside the function

try{

}

catch (Exception e){


}

finally{

}

RuntimeException

The run-time exception, which throws the exception or its subclass exception, stops the program.

Can not be declared on a function

----------------------------

1, package, Import,jar

Jar Package,

Jar

-----------------

Package the Java library file.

[Make a class under the Classpath as a jar file]

Jar CVF myjar.jar-c classes/.

Jar Cvfe Myjar.jar a.a1.a11.a111.a-c classes/. The entry point specified by E.

[Use the Java-jar parameter to run the program]

Java-jar Myjar.jar//execute JAR file

Java-jar Myjar.jar a.a1.a11.a111.a//execute the JAR file to specify the entry point.

-cp-classpath is actually the specified class file search path, in the main program need to use which class files, where to go to find, this path search order is Classpath
Attention. Indicates the current search path, do not forget.

Person.java Studentdemo.java

/*

The Person.java and Studentdemo.java files are as follows, and the student class inherits the person class.

First pack the Person.class into a jar package, jar CVF Person.jar Person.class

Then put Person.jar and Student.java under the D:\java\classes folder,

Compile: Javac Studentdemo.java//error, Prompt for person class not found,

Set the jar file under CP:

JAVAC-CP.; Person.jar Studentdemo.java//Compile pass,

Run: Java Studentdemo//Run failed, prompt for person class not found

Set the Perosn.jar under CP:

JAVA-CP.; Person.jar Studentdemo//run successfully.

*/

Import

throw new Button ();

Java.lang.throwable

/|\

|-----java.lang.Error

|-----java.lang.Exception


Problems encountered:

1, anonymous internal classes often appear syntax errors, according to the teacher method, step by step writing code, the problem has been resolved.

2, the abnormal part of the type is more, and many concepts confused, suggest the teacher detailed carding

3,jar command Packaging, parameter angle, inconvenient memory, need specific case multi-operation, multi-practice can be skilled.

4, the Access modifier section describes less, missing cases.

Questions that need help

1,jar command parameters, common operation

2, abnormal enhancement

3, access modifier case analysis.

This article from "Rookie Achievement Data Road" blog, reproduced please contact the author!

It 18 Palm Palm Seventh Day Course Summary

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.