What would be the output of the following fraction of code?
int Integer = 34 ;
char String = 'S' ;
System.out.print( Integer ) ;
System.out.print( String ) ;
int Integer = 34 ;
char String = 'S' ;
System.out.print( Integer ) ;
System.out.print( String ) ;
A. Does not compile as Integer and String are API class names.
B. Throws exception.
C. 34
D. S
E. 34 S
Answer: Option E
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
Got this error after running this program:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Type mismatch: cannot convert from String to char
Both integer and String are inbuilt classes. So we can't use variable of that name.
Predefined class can be used as identifier.
How can a class Integer and String be used in variable?
if S is capital in the name string of char type wat would be the answer
here string represented as single quote
String s='s';
String is a reference type in java so we can use it as identifiers.
predefined java classes and interfaces can be used as an identifiers but its not a good programming practice.
what is the ouptut of following programm fragment?justify.
byte b=50;
b=b*50;
here Integer and String are Defined classes in java so how can we use this as a Identifier
String and Integer are not reserved words so no need to worry