int a=1;
float b=1.0;
System.out.println(a==b);

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When does an object becomes eligible for garbage collection in java?

582


What do you understand by garbage collection in Java? Can it be forced to run?

555


What is stored procedure. How do you create stored procedure ?

1496


In the below example, how many string objects are created?

561


What is use of arraylist in java?

581






Difference between start() and run() method of thread class?

590


What is method reference?

519


What is the difference between length and length() method in java?

647


Why multiple inheritance is not supported by java?

514


How to declare an arraylist in java?

482


Can we return null in java?

643


What is an example of a constant variable?

536


How do you check if two given string are anagrams?

554


Explain the importance of finally block in java?

569


Can we sort a map in java?

578