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 : Explain Hot spot Hot spot : This is an

    Hot spot: This is an area in an image map with a specific significance. A program usually monitors movements of the mouse, and reacts according to the actions related with the hot spots over which it passes. This may comprise displaying various status

  • Q : What is an Internet Service Provider

    Internet Service Provider: It is an Internet Service Provider (abbreviated as ISP) gives connections to the Internet for users who do not contain their own network. The ISP gives such user with their own IP address which enables them to interact with

  • Q : What is Big-endian Big-endian : This is

    Big-endian: This is a common difference among machines, the order in which they store individual bytes of multi-byte numerical data. Big-endian machine stores the higher-order bytes previous to the lower-order bytes.

  • Q : Explain Java Virtual Machine Java

    Java Virtual Machine (JVM): It is an idealized machine whose instruction set comprises of bytecodes. Java program is compiled to an equal bytecode form and performed on an interpreter that implements the JVM.

  • Q : What is Reflection Reflection : It is

    Reflection: It is the ability to find out what fields, methods, constructors, and so forth, are stated for an object or class. Reflection is supported by the Class ‘class’, and other classes in the java.lang.reflect package. Reflection mak

  • Q : Explain Multiple inheritance Multiple

    Multiple inheritance: The capability of a class or interface to expand more than one interface or class. In Java, multiple inheritance is only accessible in the circumstances which are shown below: An interf

  • Q : Advantages of Object oriented

    Q. What are the advantages of Object Oriented Programming languages? Explain them. Ans. : Object oriented programming language has following advantages-

    Q : Explain the term Test Fusion Report of

    Explain the term Test Fusion Report of QTP?

  • Q : State the term URL path State the term

    State the term URL path?

  • Q : Explain the term XForms Explain the

    Explain the term XForms.

©TutorsGlobe All rights reserved 2022-2023.