Java Tip Dönüşümleri
Byte, short, int, long tiplerinin float, doublea dönüşümleri
Byte to Float
public static void main(String[] args) {
byte b=127;
float f= (float)0.6555;
f=(float)b;
System.out.println(f);
}
}
byte b=127;
float f= (float)0.6555;
f=(float)b;
System.out.println(f);
}
}
Kodun Çıkışı ;
Short to Float
public static void main(String[] args) {
short s=32654;
float f= (float)0.6555;
f=(float)s;
System.out.println(f);
}
}
short s=32654;
float f= (float)0.6555;
f=(float)s;
System.out.println(f);
}
}
Kodun Çıkışı ;
Integer to Float
public static void main(String[] args) {
int i=2145837;
float f= (float)0.6555;
f=(float)i;
System.out.println(f);
}
}
int i=2145837;
float f= (float)0.6555;
f=(float)i;
System.out.println(f);
}
}
Kodun Çıkışı ;
Long to Float
public static void main(String[] args) {
long l=922337203;
float f= (float)0.6555;
f=(float)l;
System.out.println(f);
}
}
long l=922337203;
float f= (float)0.6555;
f=(float)l;
System.out.println(f);
}
}
Kodun Çıkışı ;
Byte to Double
public static void main(String[] args) {
byte l=125;
double d= (double)0.6555;
d=(double)l;
System.out.println(d);
}
}
byte l=125;
double d= (double)0.6555;
d=(double)l;
System.out.println(d);
}
}
Kodun Çıkışı ;
Short to Double
public static void main(String[] args) {
short s=32255;
double d= (double)0.6555;
d=(double)s;
System.out.println(d);
}
}
short s=32255;
double d= (double)0.6555;
d=(double)s;
System.out.println(d);
}
}
Kodun Çıkışı ;
Integer to Double
public static void main(String[] args) {
int i= 2147483647;
double d= (double)0.6555;
d=(double)i;
System.out.println(d);
}
}
int i= 2147483647;
double d= (double)0.6555;
d=(double)i;
System.out.println(d);
}
}
Kodun Çıkışı ;
Long to Double
public static void main(String[] args) {
long l= 922375807;
double d= (double)0.6555;
d=(double)l;
System.out.println(d);
}
}
long l= 922375807;
double d= (double)0.6555;
d=(double)l;
System.out.println(d);
}
}
Kodun Çıkışı ;
Double to Float
public static void main(String[] args) {
float f=(float) 30.164;
double d= (double)0.959431854841;
d=(double)f;
System.out.println(d);
}
}
float f=(float) 30.164;
double d= (double)0.959431854841;
d=(double)f;
System.out.println(d);
}
}
Kodun Çıkışı ;
Float to Double
public static void main(String[] args) {
double d=(double) 0.959431854841;
float f= (float)30.164;
f=(float)d;
System.out.println(f);
}
}
double d=(double) 0.959431854841;
float f= (float)30.164;
f=(float)d;
System.out.println(f);
}
}
Kodun Çıkışı ;
Numan Bezaroğlu
Yorumunuzu Ekleyin