java 7个练习题

import java.util.Scanner;

public class YXY{
  public static void main(String[] args){
    long l=123456789012345l;
    System.out.print("长整数的的值是:"+l+" ");

    float f=2.4f;
    System.out.print("单精度的小数是:"+f+" ");

    boolean b=true;
    b=false;
    System.out.print("布尔型变量的值是:"+b+" ");

    byte c=3;
    c=(byte)(c+200);
    System.out.print(c);

    System.out.print((char)('a'+1)+" ");
    System.out.print((char)('你'+1)+" ");

    int e=Integer.MAX_VALUE+1;
    System.out.print(e);

    @SuppressWarnings("resource")
    Scanner input=new Scanner(System.in);
    double t;
    System.out.print("Enter the x "+" ");
    t = Double.valueOf(input.nextDouble());
    t=t/1000*1000;
    System.out.print("The calculation result is " + t +" ");


  }
}

原文地址:https://www.cnblogs.com/yuxingye/p/7590710.html