下载

1下载券

加入VIP
  • 专属下载特权
  • 现金文档折扣购买
  • VIP免费专区
  • 千万文档免费下载

上传资料

关闭

关闭

关闭

封号提示

内容

首页 《JAVA程序设计》实验报告

《JAVA程序设计》实验报告.doc

《JAVA程序设计》实验报告

林文欣
2018-12-18 0人阅读 举报 0 0 暂无简介

简介:本文档为《《JAVA程序设计》实验报告doc》,可适用于领域

《JAVA程序设计》实验报告《JAVA程序设计》实验报告姓名学号日期实验题目输出自己姓名年龄身高体重通过控制台和Eclipse运行packageschooltextpublicclassMyselfPrint{publicstaticvoidmain(Stringargs){Systemoutprintln("ÐÕÃûºÑîÊËÇÙ程序初稿ÄêÁäºÉíߺcmÌåÖغï")}}所遇问题及解决办法packageschooltextpublicclassMyselfPrint{publicstaticvoidmain(Stringargs){Systemoutprintln("ÐÕÃûºÑîÊËÇÙ调试后的ÄêÁäºÉíߺcmÌåÖغï")程序代码}}ÐÕÃûºÑîÊËÇÙÄêÁäºÉíߺcmÌåÖغï输出结果《JAVA程序设计》实验报告姓名杨仕琴学号日期实验题目打印水仙花数publicclasstest{publicstaticvoidmain(Stringargs){for(intj=j<j){for(intj=j<j){程序初稿for(intj=j<j){inti=(jj*j*)into=(j*j*jj*j*jj*j*j)if(i==o){Systemoutprintln(i)}}第一次输出结果:所遇问题及解决办法publicstaticvoidmain(Stringargs){for(intj=j<j){for(intj=j<j){for(intj=j<j){调试后的inti=(jj*j*)程序代码into=(j*j*jj*j*jj*j*j)if(i==o){Systemoutprintln(i)}}}输出结果《JAVA程序设计》实验报告姓名杨仕琴学号日期实验题目编写三个类,按照命名空间规则分别放到不同包中,在代码中调用其它包中的类,并查看类文件在系统中的组织方式packageunitpublicclassFish{程序初稿publicFish(){Systemoutprintln("iamfishfrompackage")}}packageunitpublicclassBird{publicBird(){Systemoutprintln("iambirdfrompackage")}}packageunitpublicclassPig{publicPig(){Systemoutprintln("iampigfrompackage")}}packageunitimportunitFishimportunitBirdpublicclassUnitDemo{publicstaticvoidmain(Stringargs){Fishf=newFish()Birdb=newBird()Pigp=newPig()Systemoutprintln(fgetClass()getResource("")getPath())Systemoutprintln(bgetClass()getResource("")getPath())Systemoutprintln(pgetClass()getResource("")getPath())}}所遇问题及解决办法调试后的程序代码iamfishfrompackage输出结果iambirdfrompackageiampigfrompackageC:UsersAdministratorDesktopjsoftjdyangshibinC:UsersAdministratorDesktopjsoftjdyangshibinC:UsersAdministratorDesktopjsoftjdyangshibin《JAVA程序设计》实验报告姓名杨仕琴学号日期实验题目编写三个类ComputerTime,Plane,Car和一个接口程序Common要求在未来如果增加第三种交通工具,不必修改之前任何程序,只要编写新的交通工具代码从命令行输入ComputerTime的四个参数,第一个是交通工具的类型,二到三是整数A,B,Cpackageunit程序初稿publicabstractclassCommonimplementsCommon{doubleA=doubleB=doubleC=publicvoidsetA(doublea){A=a}publicvoidsetB(doubleb){B=b}publicvoidsetC(doublec){C=c}publicabstractvoidTestV()}packageunitpublicclassPlaneextendsCommon{publicvoidTestV(){doublev=ABCSystemoutprintln("PlaneµÄËÙÈÊǺ"v)}}packageunitpublicclassCarextendsCommon{publicvoidTestV(){doublevv=A*BCSystemoutprintln("carµÄËÙÈÊǺ"v)}}packageunitpublicclassComputerTime{publicstaticvoidmain(Stringargs){}}所遇问题及主函数传参问题,询问同学和网友获得解答解决办法packageunitpublicinterfaceCommon{调试后的publicvoidTestV()程序代码}packageunitimportjavautilScannerpublicclassCarimplementsCommon{doubleA=doubleB=doubleC=publicvoidsetA(doublea){A=a}publicvoidsetB(doubleb){B=b}publicvoidsetC(doublec){C=c}publicvoidTestV(){doublevv=A*BCSystemoutprintln("carµÄËÙÈÊǺ"v)}}packageunitimportjavautilSetpublicclassPlaneimplementsCommon{doubleA=doubleB=doubleC=publicvoidsetA(doublea){A=a}publicvoidsetB(doubleb){B=b}publicvoidsetC(doublec){C=c}publicvoidTestV(){doublev=ABCSystemoutprintln("PlaneµÄËÙÈÊǺ"v)}}packageunitpublicclassComputerTime{publicstaticvoidmain(Stringargs)throwsInstantiationException,IllegalAccessException,ClassNotFoundException{Planecom=(Plane)ClassforName("unitPlane")newInstance()doubleA=DoubleparseDouble(args)doubleB=DoubleparseDouble(args)doubleC=DoubleparseDouble(args)comsetA(A)comsetB(B)comsetC(C)comTestV()}}输出结果《JAVA程序设计》实验报告姓名杨仕琴学号日期实验题目编写Calculaterjava实现一个简单计算器要求布局可以完成加减乘除。packageunit程序初稿importjavaawt*importjavaawtevent*importjavaxswing*importjavaio*importjavamath*importjavautil****<p>Title:用户应用界面计算器<p>*<p>Description:包含简易计算与功能更加强大的科学计算<p>*<p>Copyright:Copyright(c)<p>*<p>Company:四……学<p>*authorchwencongsinacom*version*publicclassCalculat{staticJTextFieldshow设置输入区显示区staticdoubleopNum=存放操作数staticStringopChar="="存放操作符staticbooleanflag=true设置标志publicstaticvoidmain(Stringargs){newEasyFrame()产生首界面简易计算器}}所遇问题及流布局方面。解决办法:看书加上问老师解决办法packageunitimportjavaawt*调试后的importjavaawtevent*程序代码importjavaxswing*publicclassCalculaterextendsJFrameimplementsActionListener{privateJPaneljPanel,jPanelprivateJTextFieldresultFieldprivateJButtons,s,s,s,s,s,s,s,s,s,b,b,b,b,f,fprivatebooleanend,add,sub,mul,divprivateStringstrprivatedoublenum,numpublicCalculater(){super("Calculater")setSize(,)Containercon=getContentPane()consetLayout(newBorderLayout())jPanel=newJPanel()jPanelsetLayout(newGridLayout(,))jPanel=newJPanel()jPanelsetLayout(newGridLayout(,))resultField=newJTextField("")jPaneladd(resultField)conadd(jPanel,BorderLayoutNORTH)s=newJButton("")saddActionListener(this)s=newJButton("")saddActionListener(this)s=newJButton("")saddActionListener(this)s=newJButton("")saddActionListener(this)s=newJButton("")saddActionListener(this)s=newJButton("")saddActionListener(this)s=newJButton("")saddActionListener(this)s=newJButton("")saddActionListener(this)s=newJButton("")saddActionListener(this)s=newJButton("")saddActionListener(this)b=newJButton("")baddActionListener(this)b=newJButton("")baddActionListener(this)b=newJButton("*")baddActionListener(this)b=newJButton("")baddActionListener(this)f=newJButton("")faddActionListener(this)f=newJButton("=")faddActionListener(this)jPaneladd(s)jPaneladd(s)jPaneladd(s)jPaneladd(b)jPaneladd(s)jPaneladd(s)jPaneladd(s)jPaneladd(b)jPaneladd(s)jPaneladd(s)jPaneladd(s)jPaneladd(b)jPaneladd(s)jPaneladd(f)jPaneladd(f)jPaneladd(b)conadd(jPanel,BorderLayoutCENTER)}publicvoidnum(inti){Strings=s=StringvalueOf(i)if(end){如果数字输入结束则将文本框置零重新输入resultFieldsetText("")end=false}if((resultFieldgetText())equals("")){如果文本框的内容为零则覆盖文本框的内容resultFieldsetText(s)}else{如果文本框的内容不为零则在内容后面添加数字str=resultFieldgetText()sresultFieldsetText(str)}}publicvoidactionPerformed(ActionEvente){数字事件if(egetSource()==s)num()elseif(egetSource()==s)num()elseif(egetSource()==s)num()elseif(egetSource()==s)num()elseif(egetSource()==s)num()elseif(egetSource()==s)num()elseif(egetSource()==s)num()elseif(egetSource()==s)num()elseif(egetSource()==s)num()elseif(egetSource()==s)num()符号事件elseif(egetSource()==b)sign()elseif(egetSource()==b)sign()elseif(egetSource()==b)sign()elseif(egetSource()==b)sign()等号elseif(egetSource()==f){str=resultFieldgetText()if(strindexOf("")<=){str=""resultFieldsetText(str)}}elseif(egetSource()==f){num=DoubleparseDouble(resultFieldgetText())if(add){num=numnum}elseif(sub){num=numnum}elseif(mul){num=num*num}elseif(div){num=numnum}resultFieldsetText(StringvalueOf(num))end=true}}publicvoidsign(ints){if(s==){add=truesub=falsemul=falsediv=false}elseif(s==){add=falsesub=truemul=falsediv=false}elseif(s==){add=falsesub=falsemul=truediv=false}elseif(s==){add=falsesub=falsemul=falsediv=true}num=DoubleparseDouble(resultFieldgetText())end=true}publicstaticvoidmain(Stringargs){Calculaterth=newCalculater()thshow()}}输出结果《JAVA程序设计》实验报告姓名杨仕琴学号日期实验题目输入若干个整数并求和直到遇到结束标志为止。在输入的过程中自动忽略掉输入的非整数通过对负数产生异常的方式程序初稿忘记保留了基本上实现了要求但是忽略了自动忽略非整数这一点。对负数的自定义异常也有点问题。程序初稿所遇问题及看书解决的自定义异常解决办法packageunitimportjavautilInputMismatchException调试后的importjavautilScanner程序代码publicclassSumget{privatestaticintiprivatestaticintsumpublicstaticvoidgoOn()throwsMyException{while(sum>=){try{Scannersc=newScanner(Systemin)i=scnextInt()}catch(InputMismatchExceptione){i=}if(i>=){if(i!=){sum=sumiSystemoutprintln(sum)}else{break}}else{thrownewMyException(i,sum)}}}publicstaticclassMyExceptionextendsException{publicMyException(inti,intsum)throwsMyException{i=i=isum=sumgoOn()}publicstaticvoidmain(Stringargs){Sumgetsumget=newSumget()try{sumgetgoOn()}catch(MyExceptione){eprintStackTrace()}}}}输出结果《JAVA程序设计》实验报告姓名杨仕琴学号日期实验题目packageunitpublicclassBook{privateStringname程序初稿privatedoublesinglePricepublicStringgetName(){returnname}publicdoublegetSinglePrice(){returnsinglePrice}publicvoidsetName(Stringname){thisname=name}publicvoidsetSinglePrice(doublesinglePrice){thissinglePrice=singlePrice}}packageunitpublicclassBooks{BookbookprivateintnumpublicBookgetBook(){returnbook}publicintgetNum(){returnnum}publicvoidsetBook(Bookbook){thisbook=book}publicvoidsetNum(intnum){thisnum=num}}packageunitimportjavautilHashMapimportjavautilIteratorimportjavautilMapimportjavautilScannerpublicclassShopCart{privateMapbook=newHashMap()每个购物车一个单独的HashMap放东西intMaxOrder=intorder=publicMapgetBook(){返回一个购物车中的HashMapreturnbook}publicvoidaddBooks(){向购物车中的HashMap添加Books对象数目不大于MaxOrderwhile(order<=MaxOrder){Systemoutprintln("请输入书名回车结束")Scannersc=newScanner(Systemin)Stringstr=scnext()Systemoutprintln("请输入该书单价回车结束")Scannersc=newScanner(Systemin)doubledou=scnextDouble()Systemoutprintln("请输入该书购买数目回车结束")Scannersc=newScanner(Systemin)inti=scnextInt()Booksbook=newBooks()Bookbook=newBook()booksetName(str)booksetSinglePrice(dou)booksetBook(book)booksetNum(i)bookput(order,book)order}}publicvoidgetSum(HashMapbookss){取得购物车HashMap中的信息算出总价格doublesum=Booksbook=newBooks()for(Iteratoriterator=booksskeySet()iterator()iteratorhasNext()){book=(Books)iteratornext()sum=(bookgetNum())*(bookgetBook()getSinglePrice())}Systemoutprintln(sum)}}packageunitimportjavautilHashMapimportjavautilIteratorimportjavautilMapimportjavautilScannerpublicclassShopCartDemo{publicstaticvoidmain(Stringargs){ShopCartshop=newShopCart()新建一个购物车shopaddBooks()购物车中加东西HashMapbook=(HashMap)shopgetBook()shopgetSum(book)购物车算总价}}所遇问题及While条件写错找了好久。解决办法packageunitpublicclassBook{调试后的privateStringname程序代码privatedoublesinglePricepublicStringgetName(){returnname}publicdoublegetSinglePrice(){returnsinglePrice}publicvoidsetName(Stringname){thisname=name}publicvoidsetSinglePrice(doublesinglePrice){thissinglePrice=singlePrice}}packageunitpublicclassBooks{BookbookprivateintnumpublicBookgetBook(){returnbook}publicintgetNum(){returnnum}publicvoidsetBook(Bookbook){thisbook=book}publicvoidsetNum(intnum){thisnum=num}}packageunitimportjavautilHashMapimportjavautilIteratorimportjavautilMapimportjavautilScannerpublicclassShopCart{privateMapbook=newHashMap()每个购物车一个单独的HashMap放东西intMaxOrder=intorder=publicMapgetBook(){返回一个购物车中的HashMapreturnbook}publicvoidaddBooks(){向购物车中的HashMap添加Books对象数目不大于MaxOrderwhile(order<=MaxOrder){Systemoutprintln("请输入书名回车结束")Scannersc=newScanner(Systemin)Stringstr=scnext()Systemoutprintln("请输入该书单价回车结束")Scannersc=newScanner(Systemin)doubledou=scnextDouble()Systemoutprintln("请输入该书购买数目回车结束")Scannersc=newScanner(Systemin)inti=scnextInt()Booksbook=newBooks()Bookbook=newBook()booksetName(str)booksetSinglePrice(dou)booksetBook(book)booksetNum(i)bookput(order,book)order}}publicvoidgetSum(HashMapbookss){取得购物车HashMap中的信息算出总价格doublesum=Booksbook=newBooks()for(Iteratoriterator=booksskeySet()iterator()iteratorhasNext()){book=(Books)iteratornext()sum=(bookgetNum())*(bookgetBook()getSinglePrice())}Systemoutprintln(sum)}}packageunitimportjavautilHashMapimportjavautilIteratorimportjavautilMapimportjavautilScannerpublicclassShopCartDemo{publicstaticvoidmain(Stringargs){ShopCartshop=newShopCart()新建一个购物车shopaddBooks()购物车中加东西HashMapbook=(HashMap)shopgetBook()shopgetSum(book)购物车算总价}}输出结果《JAVA程序设计》实验报告姓名杨仕琴学号日期实验题目packageunit程序初稿importjavaawt*importjavaawtevent*importjavaxswing*importjavaio*publicclassdddextendsJFrameimplementsActionListener{JTextAreatxtMessageJButtonbtnRead,btnWritepublicddd(){super("文本读写")txtMessage=newJTextArea(,)btnRead=newJButton("读取")btnWrite=newJButton("写入")thissetLayout(newFlowLayout())thisadd(newJLabel("文件内容:"))thisadd(txtMessage)thisadd(btnRead)thisadd(btnWrite)btnReadaddActionListener(this)btnWriteaddActionListener(this)thissetSize(,)thissetVisible(true)thissetDefaultCloseOperation(JFrameDISPOSEONCLOSE)}publicstaticvoidmain(Stringargs){newddd()}publicvoidactionPerformed(ActionEvente){JButtonbtn=(JButton)egetSource()StringfileName="D:testtxt"if(btngetText()equals("读取")){try{InputStreamis=newFileInputStream(fileName)BufferedReaderbr=newBufferedReader(newInputStreamReader(is))Stringline=StringBufferbuffer=newStringBuffer()while((line=brreadLine())!=){bufferappend(line"n")}txtMessagesetText(buffertoString())brclose()isclose()}elseif(btngetText()equals("写入")){try{Stringmsg=txtMessagegetText()OutputStreamos=newFileOutputStream(fileName)PrintStreamps=newPrintStream(os)psprint(msg)psclose()osclose()}}}}所遇问题及文件读写的类太多查API查很久解决办法packageunit调试后的importjavaawt*程序代码importjavaawtevent*importjavaxswing*importjavaio*publicclassdddextendsJFrameimplementsActionListener{JTextAreatxtMessageJButtonbtnRead,btnWritepublicddd(){super("文本读写")txtMessage=newJTextArea(,)btnRead=newJButton("读取")btnWrite=newJButton("写入")thissetLayout(newFlowLayout())thisadd(newJLabel("文件内容:"))thisadd(txtMessage)thisadd(btnRead)thisadd(btnWrite)btnReadaddActionListener(this)btnWriteaddActionListener(this)thissetSize(,)thissetVisible(true)thissetDefaultCloseOperation(JFrameDISPOSEONCLOSE)}publicstaticvoidmain(Stringargs){newddd()}OverridepublicvoidactionPerformed(ActionEvente){JButtonbtn=(JButton)egetSource()StringfileName="D:testtxt"if(btngetText()equals("读取")){try{InputStreamis=newFileInputStream(fileName)BufferedReaderbr=newBufferedReader(newInputStreamReader(is))Stringline=StringBufferbuffer=newStringBuffer()while((line=brreadLine())!=){bufferappend(line"n")}txtMessagesetText(buffertoString())brclose()isclose()}catch(Exceptionex){JOptionPaneshowMessageDialog(this,"系统IO错误~")}}elseif(btngetText()equals("写入")){try{Stringmsg=txtMessagegetText()OutputStreamos=newFileOutputStream(fileName)PrintStreamps=newPrintStream(os)psprint(msg)psclose()osclose()}catch(Exceptionex){JOptionPaneshowMessageDialog(this,"系统IO错误~")}}}}输出结果《JAVA程序设计》实验报告姓名杨仕琴学号日期实验题目设计一个火车销售模拟程序Ticketjava。假如火车站有张火车票要卖出现在有五个销售点同时售票用五个线程模拟这五个销售点的售票情况。要求:打印出各个售票点的票号各售票点不能售相同票号。packageunit程序初稿importjavautilArrayListimportjavautilListimportjavautilRandomimportjavautilconcurrentTimeUnitpublicclassprocess{publicstaticList<String>list=newArrayList<String>()publicstaticintcounter=publicstaticRandomrandom=newRandom()publicstaticvoidmain(Stringargs){initTickets()processst=newprocess()for(inti=i<=i){stnewSolder()start()}}privatesynchronizedStringgetOneTicket(){if(listsize()<=)returnreturnlistremove()}privatestaticvoidinitTickets(){for(inti=i<=i){listadd("第"i"张票")}}***售票的类专管售票*classSolderextendsThread{publicfinalintid=counterpublicSolder(){thissetName("售票窗口"id)}Overridepublicvoidrun(){while(!thisisInterrupted()){Stringticket=getOneTicket()if(ticket==){Systemoutprintln(thisgetName()":票已售空明天请早")break}Systemoutprintln(thisgetName()"卖出了"ticket)try{TimeUnitMILLISECONDSsleep(randomnextInt())}catch(InterruptedExceptione){eprintStackTrace()}}}}}所遇问题及对线程的理解问题看书解决。解决办法packageunit调试后的importjavautilArrayList程序代码importjavautilListimportjavautilRandomimportjavautilconcurrentTimeUnit***用list作为容器*这里没有生产者因为票就那么多。*Solder是消费者*publicclassprocess{publicstaticList<String>list=newArrayList<String>()publicstaticintcounter=publicstaticRandomrandom=newRandom()publicstaticvoidmain(Stringargs){initTickets()processst=newprocess()for(inti=i<=i){stnewSolder()start()}}privatesynchronizedStringgetOneTicket(){if(listsize()<=)returnreturnlistremove()}privatestaticvoidinitTickets(){for(inti=i<=i){listadd("第"i"张票")}}***售票的类专管售票*classSolderextendsThread{publicfinalintid=counterpublicSolder(){thissetName("售票窗口"id)}Overridepublicvoidrun(){while(!thisisInterrupted()){Stringticket=getOneTicket()if(ticket==){Systemoutprintln(thisgetName()":票已售空明天请早")break}Systemoutprintln(thisgetName()"卖出了"ticket)try{TimeUnitMILLISECONDSsleep(randomnextInt())}catch(InterruptedExceptione){eprintStackTrace()}}}}}输出结果《JAVA程序设计》实验报告姓名杨仕琴学号日期实验题目用JavaDB创建数据库myDB,在其中建立一个employee表。并输入相应数据。()用JDBC编写程序显示employee表中所有男员工记录()用用JDBC编写程序向employee表中增加一条数据:邢雪花女。()用JDBC编写程序将no值为的salary改为显示结果。packageunitimportjavasqlConnection程序初稿importjavasqlDriverManagerimportjavasqlResultSetimportjavasqlStatementpublicclassMydbDemo{publicstaticvoidmain(Stringargs)throwsException{ClassforName("orgapachederbyjdbcEmbeddedDriver")Connectioncn=cn=DriverManagergetConnection("jdbc:derby:helloDBcreate=true")cnsetAutoCommit(false)Statementst=cncreateStatement()stexecute("createtableemployee(novarchar(),namevarchar(),sexvarchar(),salaryfloat)")stexecute("insertintoemployeevalues('','张强','男',)")stexecute("insertintoemployeevalues('','李香','女',)")stexecute("insertintoemployeevalues('','王大山','男',)")stexecute("insertintoemployeevalues('','赵玉花','女',)")Systemoutprintln("创建员工表插入四条记录")列出四条记录ResultSetrs=stexecuteQuery("SELECT*FROMemployeewheresex='男'")Systemoutprintln("筛选出男性员工")while(rsnext()){StringBuilderbuilder=newStringBuilder(rsgetString())builderappend("t")builderappend(rsgetString())builderappend("t")builderappend(rsgetString())builderappend("t")builderappend(rsgetFloat("salary"))Systemoutprintln(buildertoString())}stexecute("insertintoemployeevalues('','刑雪花','女',)")Systemoutprintln("插入邢雪花的信息")ResultSetrs=stexecuteQuery("SELECT*FROMemployee")while(rsnext()){StringBuilderbuilder=newStringBuilder(rsgetString())builderappend("t")builderappend(rsgetString())builderappend("t")builderappend(rsgetString())builderappend("t")builderappend(rsgetFloat("salary"))Systemoutprintln(buildertoString())}stexecute("UPDATEemployeeSETsalary=WHEREemno=''")Systemoutprintln("修改号工资为")ResultSetrs=stexecuteQuery("SELECT*FROMemployee")while(rsnext()){StringBuilderbuilder=newStringBuilder(rsgetString())builderappend("t")builderappend(rsgetString())builderappend("t")builderappend(rsgetString())builderappend("t")builderappend(rsgetFloat("salary"))Systemoutprintln(buildertoString())}stexecute("droptableemployee")Systemoutprintln("删除表EMPLOYEE")stclose()rsclose()rsclose()cncommit()cnclose()}}所遇问题no列不能创建疑似关键字修改名字为emno,即可行及解决办法packageunitimportjavasqlConnection调试后的importjavasqlDriverManager程序代码importjavasqlResultSetimportjavasqlStatementpublicclassMydbDemo{publicstaticvoidmain(Stringargs)throwsException{ClassforName("orgapachederbyjdbcEmbeddedDriver")Connectioncn=cn=DriverManagergetConnection("jdbc:derby:helloDBcreate=true")cnsetAutoCommit(false)Statementst=cncreateStatement()stexecute("createtableemployee(emnovarchar(),namevarchar(),sexvarchar(),salaryfloat)")stexecute("insertintoemployeevalues('','张强','男',)")stexecute("insertintoemployeevalues('','李香','女',)")stexecute("insertintoemployeevalues('','王大山','男',)")stexecute("insertintoemployeevalues('','赵玉花','女',)")Systemoutprintln("创建员工表插入四条记录")列出四条记录ResultSetrs=stexecuteQuery("SELECT*FROMemployeewheresex='男'")Systemoutprintln("筛选出男性员工")while(rsnext()){StringBuilderbuilder=newStringBuilder(rsgetString())builderappend("t")builderappend(rsgetString())builderappend("t")builderappend(rsgetString())builderappend("t")builderappend(rsgetFloat("salary"))Systemoutprintln(buildertoString())}stexecute("insertintoemployeevalues('','刑雪花','女',)")Systemoutprintln("插入邢雪花的信息")ResultSetrs=stexecuteQuery("SELECT*FROMemployee")while(rsnext()){StringBuilderbuilder=newStringBuilder(rsgetString())builderappend("t")builderappend(rsgetString())builderappend("t")builderappend(rsgetString())builderappend("t")builderappend(rsgetFloat("salary"))Systemoutprintln(buildertoString())}stexecute("UPDATEemployeeSETsalary=WHEREemno=''")Systemoutprintln("修改号工资为")ResultSetrs=stexecuteQuery("SELECT*FROMemployee")while(rsnext()){StringBuilderbuilder=newStringBuilder(rsgetString())builderappend("t")builderappend(rsgetString())builderappend("t")builderappend(rsgetString())builderappend("t")builderappend(rsgetFloat("salary"))Systemoutprintln(buildertoString())}stexecute("droptableemployee")Systemoutprintln("删除表EMPLOYEE")stclose()rsclose()rsclose()cncommit()cnclose()}}输出结果

用户评价(0)

关闭

新课改视野下建构高中语文教学实验成果报告(32KB)

抱歉,积分不足下载失败,请稍后再试!

提示

试读已结束,如需要继续阅读或者下载,敬请购买!

文档小程序码

使用微信“扫一扫”扫码寻找文档

1

打开微信

2

扫描小程序码

3

发布寻找信息

4

等待寻找结果

我知道了
评分:

/46

《JAVA程序设计》实验报告

VIP

在线
客服

免费
邮箱

爱问共享资料服务号

扫描关注领取更多福利