java9-5 modifier

Source: Internet
Author: User
Tags modifiers

1. Modifier:
Permission modifiers: Private, default, Protected,public
Status modifier: static,final
Abstraction modifier: Abstract

Class:
Permission modifiers: default modifier, public
Status modifier: Final
Abstraction modifier: Abstract

The most used is: public

Member variables:
Permission modifiers: Private, default, Protected,public
Status modifier: static,final

The most used is: private

Construction Method:
Permission modifiers: Private, default, Protected,public

The most used is: public

Member Methods:
Permission modifiers: Private, default, Protected,public
Status modifier: static,final
Abstraction modifier: Abstract

The most used is: public

In addition to the combination of rules:
Member variable: public static final
Member Method: public static
public abstract
Public final

2, permission modifier: Y: Can call
This is similar to a package (subclass and unrelated classes) under different packages (subclass) under different packages (unrelated classes)

(private) Private Y

(default) no modifier y y

(protected) protected Y-y y

Public y y x y y



Modifier:
Permission modifiers: Private, default, Protected,public
Status modifier: static,final
Abstraction modifier: Abstract

Class:
Permission modifiers: default modifier, public
Status modifier: Final
Abstraction modifier: Abstract

The most used is: public

Member variables:
Permission modifiers: Private, default, Protected,public
Status modifier: static,final

The most used is: private

Construction Method:
Permission modifiers: Private, default, Protected,public

The most used is: public

Member Methods:
Permission modifiers: Private, default, Protected,public
Status modifier: static,final
Abstraction modifier: Abstract

The most used is: public

In addition to the combination of rules:
Member variable: public static final
Member Method: public static
public abstract
Public final

1 //The use of the class's permission modifier:2 //modifier Private is not allowed here, others cannot access it.3 //modifiers are not allowed here protected4 //the use of the class's state modifier5 //modifiers are not allowed here the static class cannot be used statically :6  Public classDemo {7 //member Variables8 Private intx = 10;9 inty = 20;Ten protected intz = 30; One  Public intA = 40; A  Public Final intb = 50; -  Public Static intc = 60; -  Public Static Final intD = 70; the //modifier Abstract is not allowed here - //abstract int e = n; -  - //Construction Method + PrivateDemo () {} -  + Demo (String name) {} A  at protectedDemo (String name,intAge ) {} -  -  PublicDemo (String name,intage,string Address) {} -  - //modifier Static is not allowed here - //Public static Demo () {} in //modifier Final is not allowed here - //Public Final Demo () {} to //modifier Abstract is not allowed here + //Public Abstract Demo () {} -  the //member Methods * //static void Show () {} $ //abstract void Show ();Panax Notoginseng //final void Show () {} -}

java9-5 modifier

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.