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

What happens when I use / and % with a negative numerator?

536


Can private class be inherited in java?

547


Can each java object keep track of all the threads that want to exclusively access it?

532


How many bits is a float?

534


Explain the use of volatile field modifier?

631






What is the difference between static binding and dynamic binding?

559


What does void * mean?

529


Explain the difference between extends thread vs implements runnable in java?

530


What is a constructor overloading in java?

516


What is garbage collection? What is the process that is responsible for doing that in java?

646


What string is utf8?

541


Find the value of a specified element of the array arr[i] where 0 <= i <= n-1

535


What are the Main functions of Java?

623


What is immutable class in java?

506


Write a program to find the greatest of three numbers in java?

556