Computer Applications
Identify the invalid identifier from the following:
Values & Data Types Java
1 Like
Answer
1value
Reason — In Java, an identifier (e.g., variable, method, or class name) must follow these rules:
- It cannot start with a digit (e.g.,
1valueis invalid because it starts with1). - It can start with a letter, an underscore (
_), or a dollar sign. - It can contain letters, digits, underscores (
_), and dollar signs after the first character.
As 1value starts with a digit, hence it is an invalid identifier.
Answered By
1 Like
Related Questions
The number of bytes occupied by a character array of four rows and three columns are:
- 12
- 24
- 96
- 48
Consider the array given below:
char ch[] = {'A','E','I','O', 'U'};Write the output of the following statements:
System.out.println(ch[0]*2);:- 65
- 130
- 'A'
- 0
There are 128 set of different characters used in a Java program.
The default value of a boolean variable is:
- False
- 0
- false
- True