下列哪个语句将数值字符串s转换为一个整数?
A: i=Integer.parseInt(s);
B: i=(newInteger(s)).intValue();
C: i=Integer.valueOf(s).intValue();
D: i=Integer.valueOf(s);
E: i=(int)(Double.parseDouble(s));
A: i=Integer.parseInt(s);
B: i=(newInteger(s)).intValue();
C: i=Integer.valueOf(s).intValue();
D: i=Integer.valueOf(s);
E: i=(int)(Double.parseDouble(s));
举一反三
- 下列程序中 s = s + j 语句共执行了______次。 Dim s As Integer Dim i As Integer, j As Integer For i = 1 To 10 Step 2 For j = 1 To 5 Step 2 s = s + j Next j Next i Print s
- 运行下列程序,单击窗体显示的结果为( )。 Private Sub Form_Click() Dim a Dim s As Integer, i As Integer a = Array(1, 2, 3) For i = 2 To 0 Step -1 s = s + a(i) * a(i) Next i Print s End Sub
- Integer类的()方法,可以将字符串参数解析为十进制整数。 A: intValue( ) B: parseInt( ) C: valueOf( ) D: charAt( )
- 设有一个串s,和一个int型变量i,以下那条语句可能产生异常? A: if ((s !=null) && ( i ==s.length())) B: if ((s ==null) && ( i ==s.length())) C: if ((s !=null) || ( i ==s.length())) D: if ((s ==null) || ( i ==s.length()))
- 以下VBA程序运行的结果是( ) Public Sub Form_Click() Dim s As Integer s = 0 For i = 1 To 2 s = 1 For j = i To 3 s = s + i * j Next j Next i MsgBox "s=" &; s End Sub A: 11 B: 18 C: 22 D: 7