Language is based on a set of tokens and a set of rules

Source: Internet
Author: User
Tags getcolor

is the language used to write computer programs.

A language is based on a set of tokens and a set of rules.

The whole of the notation string based on the rules is language.

In programming languages, these tokens are programs.

The programming language contains three aspects, namely grammar, semantics and pragmatics.

The syntax represents the structure or form of a program, that is, the combination of rules that represent the individual tokens that make up a program, but does not address the specific meaning of those tokens, nor does it involve the user. Semantic representation of the meaning of the program, that is to say in accordance with the various methods of the specific meaning of the notation, but also does not involve the use of pragmatic expression procedures and use of the relationship.

1  Packagecom.tabletest;2 3 classElectricvehicleextendstabletext_15 {4     //Private properties: Battery Brand5     PrivateString Diannchi;6     //the public get***/set*** method completes the attribute encapsulation7  8      PublicString Getdiannchi () {9         returnDiannchi;Ten     } One   A      Public voidSetdiannchi (String diannchi) { -          This. Diannchi =Diannchi; -     } the   -     //override the Run method, described as: This is an electric car using a * * brand battery. where * * data is provided by attributes -      PublicString work () { -String str= "This is a car using" + This. Getdiannchi () + "Brand Battery electric car"; +         returnstr; - } +    A } at  - classBicycleextendstabletext_15 { -      -      PublicBicycle (String Pinpai, string color) { -          -         Super. Pinpai =Pinpai; in         Super. color =color; -     } to  //override Run method, Description: This is a * * color, * * Brand of bicycles. where * * data is provided by attributes +   PublicString work () { -String str= "This is a car" + This. GetColor () + "color," + This. Getpinpai () + "brand Bike"; the System.out.println (str); *      returnstr; $  }Panax Notoginseng   - } the  +   A  the  classtabletext_15 { +     //Private properties: Brand, color, wheel (default 2), seat (default 1) -      PublicString Pinpai; $      PublicString color; $     Private intwheelnum=2; -     Private intChairnum=1; -     //Non-parametric construction method the      Publictabletext_15 () { -          Wuyi     } the       -     //Two-parameter construction method to complete the assignment of brand and color Wu      Publictabletext_15 (String Pinpai, string color) { -         Super(); About          This. Pinpai =Pinpai; $          This. color =color; -     } -     //Four parameter construction methods, assigning values to all properties, respectively -      PublicTabletext_15 (string Pinpai, String color,intWheelnum,intchairnum) { A         Super(); +          This. Pinpai =Pinpai; the          This. color =color; -          This. Wheelnum =Wheelnum; $          This. Chairnum =Chairnum; the     } the      the    //the public get***/set*** method completes the attribute encapsulation the      PublicString Getpinpai () { -         returnPinpai; in     } the   the      Public voidSetpinpai (String pinpai) { About          This. Pinpai =Pinpai; the     } the   the      PublicString GetColor () { +         returncolor; -     } the  Bayi      Public voidsetcolor (String color) { the          This. color =color; the     } -   -      Public intGetwheelnum () { the         returnWheelnum; the     } the   the      Public voidSetwheelnum (intwheelnum) { -          This. Wheelnum =Wheelnum; the     } the   the      Public intGetchairnum () {94     returnChairnum; the     } the      Public voidSetchairnum (intchairnum) { the      This. chairnum=Chairnum;98     } About      -  101     102      Public Static voidMain (string[] args) {103         104Tabletext_15 t=NewTabletext_15 ("Borter", "white"); the T.getcolor ();106 T.getpinpai ();107 System.out.println (T.getcolor ());108 System.out.println (T.getpinpai ());109          theElectricvehicle e=Newelectricvehicle ();111          theE.setdiannchi ("Borter");113 System.out.println (E.work ()); theBicycle b=NewBicycle ("Borter", "white"); the System.out.println (B.work ()); the         117         118     }119    -  }121  122 123 124     

Language is based on a set of tokens and a set of rules

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.