LEC: 5 | JAVA
LEC:5
Type Casting in JAVA
Source Code:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package lec_5;
/**
*
* @author well
*/
public class Lec_5 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
//type casting
//int i=876;
//long j=i;
//System.out.println("longer value by automatic casting " + j);
long i=876;
int j=(int)i;
System.out.println("intger value by manually casting " + j);
double x=77.889d;
int y=(int)x;
System.out.println("intger value by manually casting " + y);
}
}
Comments
Post a Comment