Java基础第三讲:Java基本语法(二)
如果您发现本文排版有问题,可以先点击下面的链接切换至老版进行查看!!!
Java基础第三讲:Java基本语法(二)

01 |
public class Lesson03_1{ |
02 |
public static void main(String[] args){ |
03 |
byte byte1= 100 ; |
04 |
short short1= 10000 ; |
05 |
char char1= 23002 ; |
06 |
int int1= 1000000 ; |
07 |
long long1= 9876543210L; |
08 |
float float1= 9876543210 .12345f; |
09 |
double double1= 9876543210.123456789 ; |
10 |
11 |
short short2=byte1; |
12 |
// byte byte2=short1; |
13 |
14 |
} |
15 |
} |

1 |
public class Lesson03_2{ |
2 |
public static void main(String[] args){ |
3 |
short short1= 100 ; |
4 |
byte byte1=short1; |
5 |
} |
6 |
} |

1 |
public class Lesson03_2{ |
2 |
public static void main(String[] args){ |
3 |
short short1= 100 ; |
4 |
byte byte1=( byte )short1; |
5 |
System.out.print(byte1); |
6 |
} |
7 |
} |
1 |
public class Lesson03_2{ |
2 |
public static void main(String[] args){ |
3 |
short short1= 250 ; |
4 |
byte byte1=( byte )short1; |
5 |
System.out.print(byte1); |
6 |
} |
7 |
} |
01 |
import java.util.List; |
02 |
public class Lesson03_3{ |
03 |
04 |
//对象 |
05 |
static Object object; |
06 |
//接口 |
07 |
static List list = null ; |
08 |
//数组 |
09 |
static int [] months; |
10 |
11 |
public static void main(String[] args){ |
12 |
System.out.println( "object=" +object); |
13 |
System.out.println( "list=" +list); |
14 |
System.out.println( "months=" +months); |
15 |
} |
16 |
} |

1 |
public class Lesson03_4{ |
2 |
public static void main(String[] args){ |
3 |
String name1= "nebulayao" ; |
4 |
String name2= null ; |
5 |
name2=name1; |
6 |
System.out.println( "name2=" +name2); |
7 |
} |
8 |
} |

- 分类:
- Java
更新时间:
上一篇:下一篇: