Type promotion rule

Q. Explain type conversion rules for basic data types in java.

Ans. Type promotion rule: Java automatically each bits or short operant to int when evaluating an expression. As usual as the automatic promotions are, they can cause confusing compile time errors.

Type promotions rule: Java defines several types promotions rule:

1.      Byte and short values are promotes in your int.

2.      If one operand is long then whole operation is promoted to long.

3.      If one is float, then the expression will be float.

4.      If any is double, then result will be double.




   Related Questions in Programming Languages

  • Q : Protocol stack of XML Web Services

    Explain the protocol stack of XML Web Services.

  • Q : What is Actual argument Actual argument

    Actual argument: The value of an argument enacted to a method from exterior to the method. Whenever a method is called, the real argument values are copied into analogous formal arguments. The kinds of the actual arguments should be compatible with th

  • Q : Define Unconditional Jumps

    Unconditional Jumps: Jumps which are not strictly upwards in the block hierarchy can require extensive control-flow manipulation, including creation of redundant code, and should be avoided if possible. Such jumps add considerable modeling overhead fo

  • Q : What is session What is meant by the

    What is meant by the session?

  • Q : What is Classpath Classpath : The path

    Classpath: The path searched by interpreter and compiler for class definitions. The class path might be set by a command-line argument to either, or through an environment variable.

  • Q : Define the term Scheduler Define the

    Define the term Scheduler: The portion of the Java Virtual Machine (abbreviated as JVM) which is responsible for managing the threads.

  • Q : Scalability aspects of a Java PathFinder

    Scalability of program model checkers such as JPF encompasses two aspects: How large a program can be model checked, and Once a defect has been detected, how readily meaningful debugging informati

  • Q : Explain Untyped Allocations Untyped

    Untyped Allocations: In C/C++ untyped allocations such as malloc, calloc, and realloc can easily be used to create overlays, which again require translation overhead to keep the corresponding non-overlaid objects consistent.

    Q : Create a BottomUpTwoThreeFourTree class

    You will need to create a BottomUpTwoThreeFourTree class, with a BottomUpTwoThreeTreeFourTree constructor which keeps no parameters. BottomUpTwoThreeTreeFourTree will require an insert(int x) method, which will insert the value 

  • Q : Application of S60 device The

    The application has been earlier tested along with an S60 2nd Edition device and this is Symbian Signed. So can I install similar application to another S60 device?

©TutorsGlobe All rights reserved 2022-2023.