Is each of the following class identifiers (a) legal and conventional,
♥ 0 |
Is each of the following class identifiers (a) legal and conventional, (b) legal but unconventional, or (c) illegal? |
Answer
class identifiers is legal When it contains only letters(a-z,A-Z), Underscore and digits(0-9)
BUT first letter is not the digit
e.g.
123MyClassName and 1To1 are illegal
MyClass123 or One_To1 are legal
Canvention in Java programing for class Identifier
First letter should be capital and each internal words are also capitalize.
for example
MyBike, MyFavorite etc. (these are conventional)
myBike , myFavorite are legal but not conventional
Let take the following example
a. myClass or associationRule (legal, Not conventional)
b. void (illegal, because void is a keyword in Java)
c. Golden Retriever (illegal, because space is not allowed)
d. invoice# (illegal, because # (special symbols) are not allowed in Java)
e. 36542ZipCode (illegal, because can not starts with digits)
f. Apartment (legal and conventional)
g. Fruit (legal and conventional)
h. 8888 (illegal, because can not starts with digits)
i. displayTotal() (illegal, because () are not allowed in Java)
j. Accounts_Receivable (illegal, Not Conventional)
The Best Research Paper Writing Service
Would you want to pay someone to write your paper professionally from scratch? 100% Original and 0% AI Content!.