Java--public_private_void_static Functional Effect

Source: Internet
Author: User

For beginners, it is familiar to these often appearing names, but they are not fully understood.

Here are one by one explanations:

Public with the Private (these two are for the permission range)

Public XXX () {} is a public method that can be called by any one of the classes.

Private XXX () {} is a private method that can only be called in this class and cannot be called by any other class.

Span style= "Font-family:helvetica, ' Sans-serif '; color: #5D5D5D;" >void int Span style= "font-family: ' The song body '; color: #5D5D5D;" >, string , float etc)

like publicvoid xxx () {} what value will not be returned when this function is completed.

but this function can be called by any other class, because the Public .

Note: If a function does not return a value, it is not used when you name it void , Eclipse An error is automatically prompted.

Static

Static is a static function that uses the Static This means that the function belongs to the class and no more objects need to be created at the time of invocation.

such as: publicstatic void Test () {}

in the Main method is not used when calling New to create an object reference, enter directly Test () refer to this function.

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/9C/4E/wKioL1lu1qzRnEsfAACegg5WZkI550.png-wh_500x0-wm_ 3-wmp_4-s_2304220552.png "title=" create object. png "alt=" wkiol1lu1qzrnesfaacegg5wzki550.png-wh_50 "/>

There are problems can add group QQ Group:610845268


This article is from the "It Bug" blog, so be sure to keep this source http://laomomo.blog.51cto.com/6595318/1948870

Java--public_private_void_static Functional Effect

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.