JAVA代码大全

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

Javacs.yzu.edu.cn@gmail.com:X...Hello,World!.......................................Unicode........................................................................................................................................................................................................................................................................................................................................................................................................................................................................ASCII.....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................Arrays...........................................Course..........................................................................................................................Java.........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................D’April,Java.Hello,World!:HelloWorld.java/***@(#)HelloWorld.java0.3008/28/10**Showmessage”Hello,World!”inConsole**@authorXiaohuaXu*@version0.30*@since0.20*@seeSystem.in*/publicclassHelloWorld{publicstaticvoidmain(String[]args){System.out.println(”Hello,World!”);}}:HelloWorldDialog.java/***@(#)HelloWorldDialog.java0.2008/28/10**Showmessage”Hello,World!”inJOptionPane**@authorXiaohuaXu*@version0.30*@since0.20*@seejavax.swing.JOptionPane*/importjavax.swing.JOptionPane;publicclassHelloWorldDialog{publicstaticvoidmain(String[]args){Stringmessage=”Hello,World!”;JOptionPane.showMessageDialog(null,message);}}:HelloWorldApp.java/***@(#)HelloWorldApp.java0.3008/28/10**Showmessage”Hello,World!”inConsole*D’April,Java*@authorXiaohuaXu*@version0.30*@since0.20*@seeSystem.in*/publicclassHelloWorldApp{publicvoidmain(){System.out.print(”Hello,World!”);System.out.println();}publicstaticvoidmain(String[]args){HelloWorldAppapp=newHelloWorldApp();app.main();}}.Unicode:UnicodeDemo.java/***@(#)UnicodeDemo.java0.2008/28/10**ShowUnicode\u2122asJavaTM**@authorXiaohuaXu*@version0.20*@since0.10*@seeJOptionPane*/publicclassUnicodeDemo{publicstaticfinalcharTRADE_MARK=’\u2122’;publicstaticvoidshow(Stringstr){javax.swing.JOptionPane.showMessageDialog(null,str);}publicstaticvoidmain(String[]args){Stringmessage=”Java”+TRADE_MARK;System.out.println(message);show(message);System.exit(0);}}.D’April,Java:Addition.java/***@(#)Addition.java**@authorXiaohuaXu*@version0.92009/03/05*/importjavax.swing.JOptionPane;publicclassAddition{publicstaticvoidmain(String[]args){StringfirstNumber;StringsecondNumber;intnumber1;intnumber2;intsum;firstNumber=JOptionPane.showInputDialog(”FirstNum”);secondNumber=JOptionPane.showInputDialog(”SecondNum”);number1=Integer.parseInt(firstNumber);number2=Integer.parseInt(secondNumber);sum=number1+number2;JOptionPane.showMessageDialog(null,”TheSumis:”+sum,”Results”,JOptionPane.PLAIN_MESSAGE);System.exit(0);}}.:DoubleDemo.java/***@(#)DoubleDemo.java**@authorXiaohuaXu*@version1.02009/03/05*/publicclassDoubleDemo{publicstaticvoidmain(String[]args){doublex=0.0;//doubledelta=0.1;//intn=10;//System.out.println(x);//D’April,Javafor(inti=0;in;i++){//10x+=delta;//deltaSystem.out.println(x);//}}}.:MaxMinValueOfVariableDemo.java/***@(#)MaxMinValueOfVariableDemo.java***@authorXiaohuaXu*@version1.0010/03/15*/publicclassMaxMinValueOfVariableDemo{publicstaticvoidmain(String[]args){System.out.println(”Thelargestbytevalueis”+Byte.MAX_VALUE+”.”);System.out.println(”Thesmallestbytevalueis”+Byte.MIN_VALUE+”.”);System.out.println(”Thelargestshortvalueis”+Short.MAX_VALUE+”.”);System.out.println(”Thesmallestshortvalueis”+Short.MIN_VALUE+”.”);System.out.println(”Thelargestintegervalueis”+Inte

1 / 89
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功