Java小程序代码.docVIP

  • 10
  • 0
  • 约1.09万字
  • 约 17页
  • 2017-05-12 发布于河南
  • 举报
Java小程序代码

Java小程序代码.txt我这人从不记仇,一般有仇当场我就报了。没什么事不要找我,有事更不用找我!就算是believe中间也藏了一个lie!我那么喜欢你,你喜欢我一下会死啊?我又不是人民币,怎么能让人人都喜欢我?/**第一个程序*/ 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; System.out.println(学生的姓名是: + aStudent.getName() + ,学号是: + aStudent.getStudentNum()); } } class People { private String name; public String getName(){ return name; } public void setName(String strName) { name = strName; } } class Student extends People { private String studentNum; public String getStudentNum() { return studentNum; } public void setStudentNum(String strStudentNum) { studentNum = strStudentNum; } } /**移位运算符测试 */ public class BitMotion { public static void main(String[] args) { int a = 15; int b = 2; int x = a b; int y = a b; int z = a b; System.out.println(a + + b + = + x); System.out.println(a + + b + = + y); System.out.println(a + + b + = + z); } } /* *测试位的四种运算 */ 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); 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); z = ((a + b) == 50); System.out.println(x= + x); System.out.println(y= + y); System.out.println(z= + z); } } /* *测试不同数制表现形式及系统的自动转化功能 */ public class ByteTest { public static void main(String[] args) { byte x = 22;//十进制 byte y = 022;//八进制 byte z = 0X22;//十六进制 System.out.println(转换成十进制,x=

文档评论(0)

1亿VIP精品文档

相关文档