码迷,mamicode.com
首页 > 其他好文 > 详细

9.18作业 杨月(1636050091)

时间:2017-09-25 14:41:02      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:技术分享   main   false   src   float   sys   str   ring   void   

1.

/*
程序员:杨月
1.需求:输出一个长整型
*/
public class Long
{
public static void main(String[] args)
{
long l=123456789;
System.out.println("长整型变量为:"+l);
}
}

技术分享

2.

/*
程序员:杨月
1.需求:输出一个单精度常量
*/
public class Float
{
public static void main(String[] args)
{
float f=(float)2.4;
System.out.println("单精度常量:"+f);
}
}

技术分享

3.

/*
程序员:杨月
1.需求:输出一个布尔型
*/
public class Boolean
{
public static void main(String[] args)
{
boolean b=true;
b=false;
System.out.println("输出一个布尔型:"+b);
}
}

技术分享

4.

/*
程序员:杨月
1.需求:强制转换
*/
public class Byte
{
public static void main(String[] args)
{
byte b=3;
b=(byte)(b+200);
System.out.println("强制转换:"+b);
}
}

技术分享

5.

/*
程序员:杨月
1.需求:字符型加法运算
*/
public class CharSum
{
public static void main(String[] args)
{
System.out.println(‘a‘+1);
System.out.println((char)(‘a‘+1));
System.out.println((char)(‘你‘+1));

}

}技术分享

6.

/*
程序员:杨月

*/
public class Overflow
{
public static void main(String[] args)
{
int big=0x7fffffff;
System.out.println(big);
}
}

技术分享

 

7.

/*
程序员:杨月
1.需求:就计算啊
*/
public class SumChar
{
public static void main(String[] args)
{
int x=20;
x=x/2*100;
System.out.println("出来:"+x);
}
}

技术分享

 

9.18作业 杨月(1636050091)

标签:技术分享   main   false   src   float   sys   str   ring   void   

原文地址:http://www.cnblogs.com/dede-6/p/7554030.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!