The following fraction of code
double STATIC = 2.5 ;
System.out.println( STATIC );
double STATIC = 2.5 ;
System.out.println( STATIC );
A. Prints 2.5
B. Rraises an error as STATIC is used as a variable which is a keyword
C. Raises an exception
D. None of these
Answer: Option A
Join The Discussion
Comments ( 11 )
Related Questions on Data Types and Variables
What is the maximum value that can be stored in a byte variable in Java?
A. 127
B. 255
C. 32767
D. 64
What is the default value of an int variable in Java if it's not explicitly initialized?
A. 0
B. 1
C. -1
D. Null
Which of the following is not a valid identifier for a Java variable?
A. my_var
B. _myVar
C. 3rdVar
D. $var
Identifiers names is not allowed keywords.How is print?
it is a case sensitive language coz this static is right not this STATIC
Yes....
It's STATIC not static
thx for making me realize the case sensitivity of STATIC
static is keyword not STATIC
Java is case-sensitive. Thus a word static and STATIC holds different meaning in Java, where static is a reserved keyword, the same word STATIC (in uppercase) can also be used as variable name too. But to avoid ambiguity in program it is advisable not to reuse reserved keywords of Java.
Java is case-sensitive. And so all the predefined and user-defined identifiers (i.e. class name, method name and variable name) and keywords in Java are case-sensitive. Thus a word static and STATIC holds different meaning in Java, where static is a reserved keyword, the same word STATIC (in uppercase) can also be used as variable name too. But to avoid ambiguity in program it is advisable not to reuse words which are predefined (keywords, class name, interface name, method name and variable name) or user-defined (class name, method name and variable name).
plzz explain me how to come ans A
Because java is case sensitive ,therefore static keyword is used in java and so STATIC is a variable name.
The correct option is A.
Because java is case sensitive. static keyword is there in java not the STATIC.
So answer is option A .
Because java is case sensitive. static keyword is there in java not the STATIC.
So answer is option A .