Is each of the following class identifiers (a) legal and conventional,

Is each of the following class identifiers (a) legal and conventional,

March 9, 2022
41 Views
0
0

Is each of the following class identifiers (a) legal and conventional, (b) legal but unconventional, or (c) illegal?

Answer and ExplanationSolution by a verified expert

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)

Purchase this answer to view it.
Click the button to login/signup and buy full solution at 2 USD only.

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!.

🎓 Write my Essay
📚 Write my Persuasive Essay
📋 Humanize AI Content for Turnitin
💻 Write my Reflective Essay
📑 Write my Research Paper
📜 Write my Thesis Paper
📘 Write my Dissertation
📋 Write my Case Study
📝 Write my Online Exam
✒️ Write my Term Paper
Write my Paper