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
However, Java does allow this because variable names are case-sensitive.
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