网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
11、在Java中,小数默认为double,如果要指定float类型请在小数后加F/f。
参考答案和解析
对
更多 “11、在Java中,小数默认为double,如果要指定float类型请在小数后加F/f。” 相关考题
考题
下列关于Java语言简单数据类型的说法中,错误的是( )。A.float类型占内存少,运算快B.float类型占内存少,但是运算速度比不上double类型C.double类型精度高于float类型D.double类型在计算机的内存中占64位
考题
下面的说法中正确的是( )。 Ⅰ:有float型数据定义float f1=100.00f;Float F1=new float(f1),要把float型转换为double型时用Double d1=F1.doubleValue()。 Ⅱ:有double型数据定义double d1=100.00;Double D1=new Double(d1),要把double型转换为int型时用 int il=D1.intValue()。 Ⅲ:当把int型转换为double型时,该转换是不能自动转换的,需要强制类型转换。 Ⅳ:以上说法都不对。A.Ⅱ、ⅢB.Ⅰ、ⅢC.Ⅰ、ⅡD.Ⅳ
考题
下面程序执行后的输出结果是(小数点后只写一位)______。 main ( ) { double d; float f; long 1; int i; i=f=1=d=20/3; printf("%d %ld %f %f \n", i,l,f,d); }A.6 6 6.0 6.0B.6 6 6.7 6.7C.6 6 6.0 6.7D.6 6 6.7 6.0
考题
以下正确的函数定义是______。A.double f1(int x,int y)B.double f1(int x;int y)C.double f1(int x;float y)D.double f1(int x,y)
考题
有下列程序 main() { double d;float f;long l;int i; i=f=1=d=20/3; printf("%d%1d %f %f\n",i,1,f,D) ; } 程序运行后的输出结果是(小数点后只写1位)( )A.6 6 6.0 6.0B.6 6 6.7 6.7C.6 6 6.0 6.7D.6 6 6.7 6.0
考题
class super { public float getNum() {return 3.0f;} } public class Sub extends Super { } Which method, placed at line 6, will cause a compiler error?()A、 Public float getNum() {return 4.0f; }B、 Public void getNum (){}C、 Public void getNum (double d){}D、 Public double getNum (float d) {retrun 4.0f; }
考题
变量x、f、d分别为int,float,double类型的,除了f和d不能等于无穷大和NAN以外值可以任意选取,下面表达式为真的是()A、x==(int)(double)xB、x==(int)(float)xC、d==(double)(float)dD、(f+d)-f==d
考题
假定变量x,f和d的类型分别为int 、float和double。下面表达式的值总是为1的是()A、x==(int)(float)xB、d==(double)(float)dC、f==(float)(double)fD、(f+d)-f==d
考题
class BaseClass{ private float x= 1.0f; protected void setVar (float f) {x = f;} } class SubClass extends BaseClass { private float x = 2.0f; //insert code here } Which two are valid examples of method overriding?() A、 Void setVar(float f) {x = f;}B、 Public void setVar(int f) {x = f;}C、 Public void setVar(float f) {x = f;}D、 Public double setVar(float f) {x = f;}E、 Public final void setVar(float f) {x = f;}F、 Protected float setVar() {x=3.0f; return 3.0f; }
考题
单选题class super { public float getNum() {return 3.0f;} } public class Sub extends Super { } Which method, placed at line 6, will cause a compiler error?()A
Public float getNum() {return 4.0f; }B
Public void getNum (){}C
Public void getNum (double d){}D
Public double getNum (float d) {retrun 4.0f; }
考题
多选题class BaseClass{ private float x= 1.0f; protected void setVar (float f) {x = f;} } class SubClass extends BaseClass { private float x = 2.0f; //insert code here } Which two are valid examples of method overriding?()AVoid setVar(float f) {x = f;}BPublic void setVar(int f) {x = f;}CPublic void setVar(float f) {x = f;}DPublic double setVar(float f) {x = f;}EPublic final void setVar(float f) {x = f;}FProtected float setVar() {x=3.0f; return 3.0f; }
考题
单选题假定变量x,f和d的类型分别为int 、float和double。下面表达式的值总是为1的是()A
x==(int)(float)xB
d==(double)(float)dC
f==(float)(double)fD
(f+d)-f==d
考题
单选题变量x、f、d分别为int,float,double类型的,除了f和d不能等于无穷大和NAN以外值可以任意选取,下面表达式为真的是()A
x==(int)(double)xB
x==(int)(float)xC
d==(double)(float)dD
(f+d)-f==d
考题
多选题class BaseClass{ private float x= 1.0f; protected void setVar (float f) {x = f;} } class SubClass exyends BaseClass { private float x = 2.0f; //insert code here 8. } Which two are valid examples of method overriding?()AVoid setVar(float f) {x = f;}BPublic void setVar(int f) {x = f;}CPublic void setVar(float f) {x = f;}DPublic double setVar(float f) {x = f;}EPublic final void setVar(float f) {x = f;}FProtected float setVar() {x=3.0f; return 3.0f; }
热门标签
最新试卷