试题详情
单项选择题 import java.io.PrintWriter;  class DoFormat {  public static void main(String [] args) { int x = 42; int y = 12345;  float z = 7; System.out.format("-%4d- ", x);  System.out.format("-%4d- ", y);  System.out.format("-%4.1d- ", z); } }  结果为:() 

A、编译失败

B、-42- -1234- -7.0-

C、- 42- -1234- - 7.0-

D、运行时异常被抛出

  • D
  • 关注下方微信公众号,在线模考后查看

热门试题