What is the output of this program?
class Literal11
{
public static void main(String[] args)
{
float d=1.2e3;
System.out.println(d);
}
}
/*
Output:- CE[possible loss of precision]
Explanation:- We can also specify floating point literal in exponential form(scientific notation).
And this notation is also treated as double literal. And double literal cannot assigned
directly to the float data type.
*/
{
public static void main(String[] args)
{
float d=1.2e3;
System.out.println(d);
}
}
/*
Output:- CE[possible loss of precision]
Explanation:- We can also specify floating point literal in exponential form(scientific notation).
And this notation is also treated as double literal. And double literal cannot assigned
directly to the float data type.
*/
0 comments: