Computer Applications
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.,
1value
is 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.
Related Questions
Assertion (A): The
boolean
data type in Java can have only two possible values:true
orfalse
.Reason (R): Boolean values in Java are stored as integers, with
true
represented by 1 andfalse
by 0.Write the memory capacity (storage size) of short and float data type in bytes.
int x = 98; char ch = (char)x; what is the value in ch?
- b
- A
- B
- 97
The default value of a boolean variable is:
- False
- 0
- false
- True