- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
java代码实例
第三章--数据类型、变量和表达式:1.public class ByteTest{public static void main ( String [] args ){int a;byte b;a=256;b=(byte)a;System.out.println( b );}}2.public class FloatTest{public static void main ( String [] args ){float f;f = 1.3 ;System.out.println( f );}}3.import javax.swing.JOptionPane;public class ComputeArea{public static void main(String[ ] args){double radius;double area;radius = Double.parseDouble(JOptionPane.showInputDialog(请输入半径值));area = radius * radius *3.14159;JOptionPane.showMessageDialog(null,area = + area);}}第四章—控制:1.// MyInput.java: Contain the methods for reading int, double, and// string values from the keyboardimport java.io.*;public class MyInput{ // Read a string from the keyboard public static String readString() { BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 1); // Declare and initialize the string String string = ; // Get the string from the keyboard try { string = br.readLine(); } catch (IOException ex) { System.out.println(ex); } // Return the string obtained from the keyboard return string; } // Read an int value from the keyboard public static int readInt() { return Integer.parseInt(readString()); } // Read a double value from the keyboard public static double readDouble() { return Double.parseDouble(readString()); } // Read a byte value from the keyboard public static double readByte() { return Byte.parseByte(readString()); } // Read a short value from the keyboard public static double readShort() { return Short.parseShort(readString()); } // Read a long value from the keyboard public static double readLong() { return Long.parseLong(readString()); } // Read a float value from the keyboard public static double readFloat() { return Float.parseFloat(readString()); }}2.import java.io.*;public class LoanCompute{public static void main(String[] args){double loan,ratio,monthlyPay,totalPay;int year;loan=ratio=monthlyPay=totalPay=0;year=0;BufferedReader br= new BufferedReader(new InputStreamReader(System.in), 1);System.out.
您可能关注的文档
最近下载
- 2025年新疆投资发展集团有限责任公司人员招聘笔试备考题库带答案详解(名师推荐).docx
- 在线网课学习课堂《临床伦理与科研道德(山东大学)》单元测试考核答案.docx VIP
- 浅谈直驱风力发电机组偏航异响原因分析及结构优化.pdf VIP
- 商务与经济统计(原书第14版)Ch11.pptx VIP
- 化工厂安全考试题.doc VIP
- 大学生女性健康科普知识讲座幻灯片.ppt
- 《阿Q正传》课件63张.pptx VIP
- 渥太华自伤量表.docx VIP
- 【2025年新版交规题库】2025年版12123学法减分题库(学法减分300题).docx
- 商务与经济统计(原书第14版)Ch16.pptx VIP
文档评论(0)