Wednesday, April 20, 2022

WHAT’S WRONG WITH THIS? What is wrong with these variable names? Can you correct them? 1. City/State referencing a city and state. 2. LN referencing a last name.

WHAT’S WRONG WITH THIS?

What is wrong with these variable names? Can you correct them?

1.       City/State referencing a city and state.

2.       LN referencing a last name.




1 Approved Answer

Nilanjana M 
5 Ratings,(9 Votes)
Rules for naming a variable: 1. Variable names can start with alphabet, and underscores only. 2 it should not have white spaces 3 it must not have any reserved word 4 it can have alphabet, digit and underscores Ans 1) String city = " abc"; String state = " efg"; String lastname = " xyz";

No comments:

Post a Comment