Explanation:
(a) Invalid
Because if is a keyword in java and keywords cannot be used as variable names
(b) Valid
(c) Valid
(d) Invalid
Because variable name cannot start with any digit.
Note:-
RULES OF WRITING VARIABLES IN JAVA:-
1) Variables never start with any digit.(14ST - wrong)
2) White space is not allowed( Number 1 - wrong Number1- correct
3) Special characters are not allowed.
=> Only 2 special characters you can use,i.e.
abc$- correct
abc#- wrong
=> User can declare the special character at any position( beginning, mid, end) ------> _x - correct
a$bc- correct
4) Java keywords cannot be used as variable names.
5) Variable can contain uppercase character or lower case character or both. ------> SUM - correct
sum - correct
Sum - correct
Hope it helps....
PLEASE MARK ME AS BRAINLIEST AND DON'T FORGET TO FOLLOW ME...
Copyright © 2024 EHUB.TIPS team's - All rights reserved.
Answers & Comments
Verified answer
Explanation:
(a) Invalid
Because if is a keyword in java and keywords cannot be used as variable names
(b) Valid
(c) Valid
(d) Invalid
Because variable name cannot start with any digit.
Note:-
RULES OF WRITING VARIABLES IN JAVA:-
1) Variables never start with any digit.(14ST - wrong)
2) White space is not allowed( Number 1 - wrong Number1- correct
3) Special characters are not allowed.
=> Only 2 special characters you can use,i.e.
abc$- correct
abc#- wrong
=> User can declare the special character at any position( beginning, mid, end) ------> _x - correct
a$bc- correct
4) Java keywords cannot be used as variable names.
5) Variable can contain uppercase character or lower case character or both. ------> SUM - correct
sum - correct
Sum - correct
Hope it helps....
PLEASE MARK ME AS BRAINLIEST AND DON'T FORGET TO FOLLOW ME...