Answer to Question #316226 in Java | JSP | JSF for bhupendra

Question #316226

The following code results in compile time error. Identify the error.

public static void display ()

{

int n =123456;

float f =100.12;

System.out.println(“Float value ” +f);

}


1
Expert's answer
2022-03-22T15:33:57-0400
/*
To indicate that a given value should be treated as a float,
we need to use the f suffix:
float fl = 30.6f;
               ^
 */
public static void display (){
    int n =123456;
    float f =100.12f;
    System.out.println("Float value " + f);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS