2022年Java_小程序代码 .pdf
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《2022年Java_小程序代码 .pdf》由会员分享,可在线阅读,更多相关《2022年Java_小程序代码 .pdf(30页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、/* 第一个程序 */ public class Welcome public static void main(String args) System.out.println( 这是你的第一个程序,欢迎你走入Java的大门); /* 学生信息导入 */ class StudentTest public static void main(String args) Student aStudent = new Student(); aStudent.setName(张楠); aStudent.setStudentNum(20030408); System.out.println(学生的姓名是:
2、+ aStudent.getName() + ,学号是: + aStudent.getStudentNum(); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 30 页 - - - - - - - - - class People private String name; public String getName() return name; public void setName(String strName) name = strName; class Stude
3、nt extends People private String studentNum; public String getStudentNum() 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 30 页 - - - - - - - - - return studentNum; public void setStudentNum(String strStudentNum) studentNum = strStudentNum; /* 移位运算符测试*/ public c
4、lass BitMotion public static void main(String args) int a = 15; int b = 2; int x = a b; int z = a b; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 30 页 - - - - - - - - - System.out.println(a + + b + = + y); System.out.println(a + + b + = + z); /* * 测试位的四种运算*/
5、public class BitOperation public static void main(String args) int a = 15; int b = 2; int x = a & b; int y = a | b; int z = a b; int r = x; System.out.println(a + & + b + = + x); System.out.println(a + | + b + = + y); System.out.println(a + + b + = + z); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - -
6、- - - - - - 名师精心整理 - - - - - - - 第 4 页,共 30 页 - - - - - - - - - System.out.println( + x + = + r); /* * 测试 boolean型数据*/ public class BooleanTest public static void main(String args) int a = 20; int b = 30; boolean x, y,z; x = (a b); y = (a b; b = R != r; x = !a; y = a & b; z = a | b; System.out.print
7、ln(x = + x); System.out.println(y = + y); System.out.println(z = + z); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 17 页,共 30 页 - - - - - - - - - /* * 关系运算符测试*/ public class RelationT est public static void main(String args) boolean x, y, z; int a = 15; int b = 2;
8、double c = 15; x = a b;/true; y = a b;/false; z = a != b;/true; System.out.println(x = + x); System.out.println(y = + y); System.out.println(z = + z); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 18 页,共 30 页 - - - - - - - - - /* * 测试自增、自减操作*/ public class SelfActio
9、n public static void main(String args) int x = 10; int a = x + x+; System.out.println(a= + a); System.out.println(x= + x); int b = x + +x; System.out.println(b= + b); System.out.println(x= + x); int c = x + x-; System.out.println(c= + c); System.out.println(x= + x); int d = x + -x; System.out.printl
10、n(d= + d); System.out.println(x= + x); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 19 页,共 30 页 - - - - - - - - - /* * 短路现象测试*/ public class ShortCircuit public static void main(String args) ShortCircuit a = new ShortCircuit(); if( a.test1(0) & a.test2(2) & a.test3
11、(2) System.out.println(the statement is true!); else System.out.println(the statement is false!); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 20 页,共 30 页 - - - - - - - - - public boolean test1(int value1) System.out.println(test1 ( + value1 + ); System.out.println
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年Java_小程序代码 2022 Java_ 程序代码
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内