如何在java中编写上标文本?

时间:2016-06-26 07:17:40

标签: java

我想在加速度输出中以米为单位显示米/秒(2)。我应该使用哪个关键字?

public class Distance {
public static void main(String[] args)
{
    int distance,init_velocity,time,acceleration;
    acceleration=10;
    init_velocity=20;
    time=20;
    distance=(init_velocity*time)+((acceleration*time*time)/2);
    System.out.println("-------------------------------------------------------------------------");
    System.out.println("Distance travelled by John ="+ distance+"  "+"meters" );
    System.out.println("-------------------------------------------------------------------------");
  }  
}

1 个答案:

答案 0 :(得分:1)

尝试:System.out.println("meter/second\u00b2");