Examveda
Examveda

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 ) ;

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


This Question Belongs to Java Program >> Data Types And Variables

Join The Discussion

Comments ( 11 )

  1. Krishna Sankarasetti
    Krishna Sankarasetti :
    1 year ago

    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

  2. Shashikant Jagtap
    Shashikant Jagtap :
    3 years ago

    Both integer and String are inbuilt classes. So we can't use variable of that name.

  3. Nikhil Rj
    Nikhil Rj :
    6 years ago

    Predefined class can be used as identifier.

  4. Gayatri Budha
    Gayatri Budha :
    6 years ago

    How can a class Integer and String be used in variable?

  5. Julakanti Sai
    Julakanti Sai :
    6 years ago

    if S is capital in the name string of char type wat would be the answer

  6. Madugula Nagendra
    Madugula Nagendra :
    7 years ago

    here string represented as single quote

    String s='s';

  7. Sonu Shaw
    Sonu Shaw :
    7 years ago

    String is a reference type in java so we can use it as identifiers.

  8. Sachin Dandge
    Sachin Dandge :
    7 years ago

    predefined java classes and interfaces can be used as an identifiers but its not a good programming practice.

  9. Dipti Chavan
    Dipti Chavan :
    7 years ago

    what is the ouptut of following programm fragment?justify.
    byte b=50;
    b=b*50;

  10. Mahendra Pirtani
    Mahendra Pirtani :
    7 years ago

    here Integer and String are Defined classes in java so how can we use this as a Identifier

  11. Tushar Zagade
    Tushar Zagade :
    7 years ago

    String and Integer are not reserved words so no need to worry

Related Questions on Data Types and Variables