EXPRESSION AND TYPE CASTING/CONVERSION


 Expression and Type Conversion : 

An expression is any valid combination of operators , constants and variables 


  • Pure Expression : All the operands are of same types. 
  • Mixed Expression : the Operands are of mixed expression or different data types. 


Type Conversion : the process of converting one predefined type into another is called TYPE CONVERSION.

  •  Implicit type conversion : It is performed by the compiler without programmer's intervention. It convert all operands upto the type of the largest operands .
  • Explicit type conversion : It is performed by the user is called Type Casting. It covert all the operands as per the given data types. 


Variables and constant

A variable is a named memory location , which hold data value of a particular data type. 


  1. Global : Variables that are available inside any block of the program 
  1. Local : Variables that are available inside the block in which they are created . 
  1. Static : Variables that are called class variable share single memory between different objects. 
  1. Instance : non static variables that share Different memory between different objects. 
  1. Constant : If variable declared as Final than it is called as constant variable and Its value never changed in program. 


Precedence of operators : java has well defined rules for the operators in an expression Is evaluated. Precedence rules can be overridden by explicit parentheses . 


Associatively : Associatively is the grouping of operands and operators in an expression where more than one operator of the same precedence exist. 


Post a Comment

0 Comments