Java Learning Note 04

Source: Internet
Author: User

1.this

This points to the current object.

public class helloworld{

String name = "Orange Mulberry";

public void call () {

System.out.println (this.name);

}

}

Several types in 2.java

We know how to define a class, and on that basis, there are subclasses, inner classes.

Class baseclass{//Parent}

Class Newclass extends baseclass{//subclass}

This subclass Newclass inherits all the properties and methods of the parent class, and additionally has its own properties and methods.

public class Wrap {

public class innerclass{
public void Say () {
System.out.println ("Method of the Inner class");
}
}

Program entry
public static void Main (string[] args) {
TODO auto-generated Method Stub
Wrap hi = new Wrap ();//Instance Partial
innerclass Hello = hi.new innerclass (); Instantiate an inner class, note the wording
Hello.say ();
}
}

The above is how to define the inner class and call.

3.

Java Learning Note 04

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.