6-5-1

Source: Internet
Author: User

//6-5-1 casesPackage Lesson2; Public classDemo2 { Public Static voidMain (string[] args) {A A1=NewA (); A1.I=Ten; A A2=NewA (); A2.I=Ten; /** A1 Why can I call the Equals method * methods in the object class inherit into Class A*/System. out. Print (A1.equals (A2)); }}classa{inti; /*Public Boolean equals (Object obj) {return (this = = obj);*/     Publicboolean equals (A aa) {return  This. i==aa.i; }//and the inherited methods of the parent class make up the overloaded}

/*
8. Import the Project
File---import--general--double-click Existiong Project into workspace--browser--selected item name
JavaBean
JavaBean is a Java class
The standard JavaBean is a Java class attribute private with parameterless constructors
There are getter/setter methods for all attributes.


Method overrides
When a method overrides (function overrides), access privileges can be extended
To override a method, the parent class must not be private because the private subclass cannot directly access
Access can be expanded and cannot be reduced

Java.lang.Object;
1. Many classes do not have a guide package, such as the string class, the math class is the class under the Java.lang package, is provided by the JDK,
Classes under the Java.lang package in the class provided by the Jak are not directly available without a guide package
2. A class if there is no parent class, then the parent class is the object class
Inheritance in Java is a single inheritance, that is, a class has only one direct parent class
Inheritance in Java has transitivity
A.A Inherited B,b inherited c,c no parent class
B.C's parent class is object. The elements in the object's exhaustion inherit to C, and inherit to B, and inherit to a.
You can think of B as the parent of a, C is the parent of a, and object is the parent of a.
How to see the source code of Java in Eclipse
Press CTRL to move the mouse to the function or class you need to see the first time there is an option on the class interface-"Attach sourse---Click--Select the package that contains the file

*/

6-5-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.