float variables initialization java

前端 未结 6 1096
面向向阳花
面向向阳花 2021-01-23 04:17

The following code snippet gave me compiler error at Line 1.

public abstract class xyz
{

    float Gamma = 20.0; //Line 1
    public class Alpha
    {
        v         


        
6条回答
  •  一生所求
    2021-01-23 04:33

    As per my understanding, float is used for decimal variables.

    No. Numerical literals with fraction parts are treated as doubles by default.

提交回复
热议问题