• 第三次作业--林枫


    1.
    /*功能:输出一个长整型的变量 123456789012345*/
    public class Lin{ public static void main(String[] args) { long l=123456789012345l; System.out.println(l); } }

    2./**功能:输出一个单精度的小数常量 2.4
    */
    public class Float{ public static void main(String[] args) { float f=2.4f; System.out.println(f); } }

    3./**功能:输出布尔类型的变量
    */
    public class Bl{
       public static void main(String[] args)
       {
           boolean b=true;
           System.out.println(b);
    b=false;     System.out.println(b); } }

    4.
    public class Be{ public static void main(String[] args) { byte b=3; b=(byte)(b+200); System.out.println(b); } }

    
    

    5./**功能:输出字符型的加法计算
    */

    public class So{
       public static void main(String[] args)
       {
            System.out.println((char)('a'+1));
            System.out.println((char)('你'+1));
       }
    }

    6./**功能:演示变量的溢出效果

     */

    public class M{
       public static void main(String[] args)
       {
    		int i=Integer.MAX_VALUE+1;
    		System.out.println(i);
       }
    }

    
    

    7./**功能:给x赋值,进行x=x/1000*1000的计算并输出结果

    */

    import java.util.Scanner;
    public class Mh{
       public static void main(String[] args)
       {
            Scanner input=new Scanner(System.in);
    		double x;
    		System.out.println("Enter the x ");
            x = Double.valueOf(input.nextDouble());
    		x=x/1000*1000;
    		System.out.println("The calculation result is " + x);
       }
    }

    
    


  • 相关阅读:
    Luogu P2495 [SDOI2011]消耗战
    40. Combination Sum II
    39. Combination Sum
    22. Generate Parentheses
    51. N-Queens
    Codeforces Round #346 (Div. 2) E. New Reform
    Codeforces Round #346 (Div. 2) D. Bicycle Race
    HDU 5651xiaoxin juju needs help
    VK Cup 2016
    Educational Codeforces Round 10 D. Nested Segments
  • 原文地址:https://www.cnblogs.com/linfenglf/p/7588838.html
Copyright © 2020-2023  润新知