[ floatconvert.java ]
import java.io.*;class floatconvert
{
public static void main(String args[])
{
float fno=(float)67.5;
System.out.println("DIVIDE BY ZERO : " + fno/0);
int ino=901611583;
fno=ino; // converting from int to float
System.out.println("AFTER INT TO FLOAT VALUE OF FLOAT : " + fno);
ino=(int)fno; // converting from float to int
System.out.println("AFTER FLOAT TO INT VALUE OF INT : " + ino);
}
}
GoTo Command Prompt(Win + R)
ReplyDeleteHOW TO COMPILE
javac c:\yourdir\floatconvert.java
HOW TO EXECUTE
java c:\yourdir\floatconvert