int a=1;
float b=1.0;
System.out.println(a==b);
Answers were Sorted based on User's Feedback
Answer / aruna
this code will not compile since 1.0 will be taken as a
double instead of float, To make this code work, the
following changes shud b done
float b=1.0f;
or double = 1.0;
with these changes the SOP statement will print "true"
| Is This Answer Correct ? | 15 Yes | 0 No |
Answer / anil kumar rai
error found when compile this code;
if u write 1 in place of 1.0 then output would be "true" or
if u write double in place of float then output would be
same :"true"
thank you
| Is This Answer Correct ? | 13 Yes | 1 No |
Answer / ranga reddy
int a = 1;
float b = 1.0;
System.out.println(a==b);
if we declare float b = 1.o; by default it takes double value, then it will give compile time error as possiblelossofpression
then we declare as float b = 1.0f;
at this time System.out.println(a==b); gives
true
| Is This Answer Correct ? | 5 Yes | 0 No |
Answer / saranya
ya its true only because content remains the same
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / kavitha
if u just convert the float to double that will be sufficient
u get the answer "true"
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / sudha
if u write
int a=1;
float b=1.0f;
system.out.println(a==b);
answer woill b true...as of now it wont compile
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / anilkumar munaganuri
in above question by providing explicit type casting as
float b=(float)1.0
then we can get output as true
| Is This Answer Correct ? | 1 Yes | 0 No |
What is the middleware?
Can you give few examples of final classes defined in java api?
What is java util collection?
Suppose there is an array list [10,5,20,19,15,24].Print them in ascending & descending order in collection framework concept ???
Explain about the select method with an example?
how many ways to create Thread and which one is good? runnable interface ot Thread class?
What invokes a thread's run() method in java programming?
Tell me the difference between an applet and a Japplet?
What are different types of encoding?
Explain about member inner classes?
What are the types of java?
what is finalmethod & final variable with example?