• 黄宗禹9.18作业


    1./**功能:输出一个长整型的变量 123456789012345
    */
    public class Long{ 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 Boolean{
       public static void main(String[] args)
       {
           boolean b=true;
           System.out.println(b);
    b=false;     System.out.println(b); } }
    
    

    4.

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

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

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

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

     */

    public class Max{
       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 Math{
       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);
       }
    }

     
     
  • 相关阅读:
    jquery 设置焦点
    hibernate DetachedCriteria实现多表关联查询createAlias的使用
    js-处理千分符
    json-jsonConfig使用
    json:There is a cycle in the hierarchy!
    Hibernate @OneToMany 一对多注解
    Hibernate @Formula 注解方式
    Freemarker 各种格式化
    Freemarker list标签,list数据判断使用
    js处理日期格式化-年月日周
  • 原文地址:https://www.cnblogs.com/huangzongyu/p/7545423.html
Copyright © 2020-2023  润新知