QN003. Write a program to convert data types.
1. Objective
To convert the data types from one type to another.
2. Theory
      When we assign value of one data type of one data type to another, the two types might not be compatible with each other. There are two types of type conversion in Java. 
      -> If the data types are compatible, then Java will perform the conversion automatically known as Automatic type conversion. 
      -> If the data types are not compatible, then they need to be casted or converted explicitly.(Sometimes data will be lost)
    
3. Source Code
      public class Qn003{ 
      public static void main(String[] args){
      // automatic type conversion 
        int i = 100;  
            long l = i;  
            float f = l; 
            System.out.println("Int value "+i); 
            System.out.println("Long value "+l); 
            System.out.println("Float value "+f); 
            System.out.println("\n");
        
        //explicit type casting 
        double d = 100.04;  
            long lon = (long)d; 
  
            int num = (int)lon;  
            System.out.println("Double value "+d); 
            //fractional part lost 
            System.out.println("Long value "+lon);
            System.out.println("Int value " + num);  
      }
    }
    
    4. Output
      Int value 100 
      Long value 100 
      Float value 100.0 
      
      Double value 100.13 
      Long value 100 
      Int value 100
    
5. Conclusion
In this way, I would like to conclude that, if we have to assign value of smaller data type to a bigger data type we can use windening or automatic conversion. For incompatible data types we can use narrowing or explicit conversion.