Java type conversion and casting Question 3

Question

What is the output of the following code?

Can the following conversions involving casting be allowed? If so, find the converted result.

public class Main {
   public static void main(String[] argv) throws Exception {
      char c =  'A'; 
      int i = (int)c;
      System.out.println(i);//w w  w .  j av a  2  s. c  om

      float f = 1000.34f; 
      i = (int)f;
      System.out.println(i);

      double d = 1000.34; 
      i = (int)d;
      System.out.println(i);

      i = 97; 
      c = (char)i;      
      System.out.println(c);

   }
}


65
1000
1000
a



PreviousNext

Related