《北京交通大学java语言程序设计实验报告》由会员分享,可在线阅读,更多相关《北京交通大学java语言程序设计实验报告(28页珍藏版)》请在人人文库网上搜索。
1、Java语言程序设计”实验报告实验2刘黎() 电子信息工程学院 2014-10-13一、 实验要求二、 实验环境 实验地点:东校区机房 实验时间:2014年10月13日 操作系统:Windows7 JDK版本:三、 程序源代码public class Test2public static void main(String arg)char myName=刘,黎;int myID=;System.out.printf(我的名字是:);System.out.print(myName);System.out.printf( 我的学号是:);System.out.println(myID);Syste。
2、m.out.printf( );System.out.println(Integer.toHexString(myID);System.out.printf(我的名字的Unicode编码是:);System.out.println(Integer.toHexString(myName0)+ +Integer.toHexString(myName1);System.out.printf(名字的unicode码变换后是:);myName0 = 1;myName1 = 1;System.out.print(Integer.toHexString(myName0)+ +Integer.toHexStr。
3、ing(myName1);System.out.printf(我的名字变成了:);System.out.println(myName);int a,b,c;a = myID/;b = myID%/1000;c = myID%1000;System.out.printf(我的学号的三个段分别是:);System.out.print(a+ +b+ +c);四、 程序运行结果五、 问题和总结今天是第二次java实验上机。这个实验做的是java的输出指令语句练习,其中包括了字符串数组的使用,字符串的连接,字符和Unicode码的转换 ,虽然只是很简单的几句程序语言,但是缺乏练习的我编写起来还是很费力,。
4、最后虽然能按照要求显示结果,但是我知道这些语句还有很多不足或者说是错误的地方,在今后的学习当中,我还得花更多的时间来学好java.“Java语言程序设计”实验报告实验3刘黎() 电子信息工程学院 2014-10-20六、 实验要求七、 实验环境 实验地点:东校区机房 实验时间:2014年10月20日 操作系统:Windows7 JDK版本:八、 程序源代码import java.util.Scanner;public class Testpublic static void main(String args)int myID;String myName;Scanner sc1 = new Sc。
5、anner(System.in);myName = sc1.next();myID = sc1.nextInt();sc1.close();System.out.printf(我叫%s,我的学号是%dn,myName,myID);System.out.printf(我姓%c,我的名字是%cn,myName.charAt(0),myName.charAt(1);char mycha