Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Java, which of the following is a syntax error? int a= 10,int ab= 10.4f,float b= 10,double c= 10.0。 Kneel for answers.
Java, which of the following is a syntax error? int a= 10,int ab= 10.4f,float b= 10,double c= 10.0。 Kneel for answers.
Int ab= 10.4f is wrong. The error prompt is: "Type mismatch, floating-point data cannot be converted to integer type int"

In Java, automatic conversion of simple data types can only be converted from low-level types to high-level types. Low-level refers to either low precision (such as integer relative to floating-point decimal) or small memory for storing data, that is, small data span (such as integer relative to long integer). If you want to convert from a high-level type to a low-level type, you must use a cast.