java基础代码大全

合集下载

java 常用代码样版

java 常用代码样版

java 常用代码样版在Java开发领域中,开发人员常常需要为业务需求编写各种代码,包括实现算法、数据库访问、网络通信等等。

为了提高开发效率以及代码的可读性,我们需要学会使用一些常用代码样板,这样可以避免重复的工作,也提高了代码的可维护性。

下面,我将为大家介绍几个常用的Java代码样板:一、单例模式样板```public class Singleton {private static Singleton instance = null;private Singleton() {}public static Singleton getInstance(){if(instance == null) {instance = new Singleton();}return instance;}}```二、静态工厂样板```public class StaticFactory {public static Product getProduct(String type) {if (type.equals("productA")) {return new ProductA();} else if (type.equals("productB")) {return new ProductB();} else {return null;}}}```三、工厂方法样板```public interface Factory {public Product getProduct();}public class ProductAFactory implements Factory { public Product getProduct() {return new ProductA();}}public class ProductBFactory implements Factory { public Product getProduct() {return new ProductB();}}```四、代理模式样板```public interface Subject {public void request();}public class RealSubject implements Subject {public void request() {System.out.println("真实对象的请求");}}public class Proxy implements Subject {private RealSubject realSubject;public Proxy() {}public void request() {if(realSubject == null) {realSubject = new RealSubject();}preRequest();realSubject.request();postRequest();}private void preRequest() {System.out.println("请求前的处理...");}private void postRequest() {System.out.println("请求后的处理...");}}```五、观察者模式样板```public interface Observer {public void update();}public class ConcreteObserver implements Observer { public void update() {System.out.println("接收到通知,开始更新自己..."); }}public interface Subject {public void attach(Observer observer);public void detach(Observer observer);public void notifyObservers();}public class ConcreteSubject implements Subject {private List<Observer> observers = newArrayList<Observer>();public void attach(Observer observer) {observers.add(observer);}public void detach(Observer observer) {observers.remove(observer);}public void notifyObservers() {for (Observer observer : observers) {observer.update();}}}```六、策略模式样板```public interface Strategy {public void algorithm();}public class ConcreteStrategyA implements Strategy { public void algorithm() {System.out.println("使用算法A");}}public class ConcreteStrategyB implements Strategy { public void algorithm() {System.out.println("使用算法B");}}public class Context {private Strategy strategy;public Context(Strategy strategy) {this.strategy = strategy;}public void setStrategy(Strategy strategy) {this.strategy = strategy;}public void run() {strategy.algorithm();}}```以上就是几个常用的Java代码样板,这些样板代码不仅可以帮助开发人员提高开发效率,同时也提高了代码的可读性和可维护性。

Java基础之代码死循环详解

Java基础之代码死循环详解

Java基础之代码死循环详解⽬录⼀、前⾔⼆、死循环的危害三、哪些场景会产⽣死循环?3.1 ⼀般循环遍历3.1.1 条件恒等3.1.2 不正确的continue3.1.3 flag线程间不可见3.2 Iterator遍历3.3 类中使⽤⾃⼰的对象3.4 ⽆限递归3.5 hashmap3.5.1 jdk1.7的HashMap3.5.2 jdk1.8的HashMap3.5.3 ConcurrentHashMap3.6 动态代理3.7 我们⾃⼰写的死循环3.7.1 定时任务3.7.2 ⽣产者消费者四、⾃⼰写的死循环要注意什么?⼀、前⾔代码死循环这个话题,个⼈觉得还是挺有趣的。

因为只要是开发⼈员,必定会踩过这个坑。

如果真的没踩过,只能说明你代码写少了,或者是真正的⼤神。

尽管很多时候,我们在极⼒避免这类问题的发⽣,但很多时候,死循环却悄咪咪的来了,坑你于⽆形之中。

我敢保证,如果你读完这篇⽂章,⼀定会对代码死循环有⼀些新的认识,学到⼀些⾮常实⽤的经验,少⾛⼀些弯路。

⼆、死循环的危害我们先来⼀起了解⼀下,代码死循环到底有哪些危害?程序进⼊假死状态,当某个请求导致的死循环,该请求将会在很⼤的⼀段时间内,都⽆法获取接⼝的返回,程序好像进⼊假死状态⼀样。

cpu使⽤率飙升,代码出现死循环后,由于没有休眠,⼀直不断抢占cpu资源,导致cpu长时间处于繁忙状态,必定会使cpu使⽤率飙升。

内存使⽤率飙升,如果代码出现死循环时,循环体内有⼤量创建对象的逻辑,垃圾回收器⽆法及时回收,会导致内存使⽤率飙升。

同时,如果垃圾回收器频繁回收对象,也会造成cpu使⽤率飙升。

StackOverflowError,在⼀些递归调⽤的场景,如果出现死循环,多次循环后,最终会报StackOverflowError栈溢出,程序直接挂掉。

三、哪些场景会产⽣死循环?3.1 ⼀般循环遍历这⾥说的⼀般循环遍历主要是指:for语句foreach语句while语句这三种循环语句可能是我们平常使⽤最多的循环语句了,但是如果没有⽤好,也是最容易出现死循环的问题的地⽅。

java基础代码大全

java基础代码大全

/*1. 打印:--------------------------------------------------2. 求两个浮点数之商。

3. 对一个数四舍五入取整。

4. 判断一个数是否为奇数5. 求一个数的绝对值。

6. 求两个数的最大值。

7. 求三个数的最大值。

8. 求1-n之和。

9. 求1-n中的奇数之和。

10. 打印自2012年起,n年内的所有闰年。

11. 打印n行星号组成的等腰三角形。

12. 求两个正整数的最小公倍数。

13. 判断一个数是否为质数。

14. 求两个正整数的最大公约数。

15. 求一个正整数n以内的质数。

16. 求一个正整数n以内的质数。

17. 分别利用递推算法和递归算法求n! 。

*/class A{static void f(){System.out.println("----------------------");//1.打印:-----------}static double quzheng(double a){int b;System.out.println((b=(int)(a+0.5)));//2.求两个浮点数之商。

return(b);}static double qiushang(double a,double b){ //3.对一个数四舍五入取整System.out.println((a/b));return(a/b);}static boolean odd(int c){ //4.判断一个数是否为奇数if(c%2==0){return(false);}else{return(true);}}static int juedui(int d){ //5.求一个数的绝对值。

if(d<0){d=0-d;System.out.println(d);else{d=d;System.out.println(d);}return(d);}static int max(int e,int f){ //6.求两个数的最大值。

Java Scritp 常用代码大全(3)

Java Scritp 常用代码大全(3)

javascript 常用代码大全(3)打开模式对话框返回模式对话框的值全屏幕打开 IE 窗口脚本中中使用xml一、验证类1、数字验证内2、时间类3、表单类4、字符类5、浏览器类6、结合类二、功能类1、时间与相关控件类2、表单类3、打印类4、事件类5、网页设计类6、树型结构。

7、无边框效果的制作8、连动下拉框技术9、文本排序10,画图类,含饼、柱、矢量贝滋曲线11,操纵客户端注册表类12,DIV层相关(拖拽、显示、隐藏、移动、增加)13,TABLAE相关(客户端动态增加行列,模拟进度条,滚动列表等) 14,各种object classid=>相关类,如播放器,flash与脚本互动等16, 刷新/模拟无刷新异步调用类(XMLHttp或iframe,frame)针对javascript的几个对象的扩充函数function checkBrowser(){this.ver=navigator.appVersionthis.dom=document.getElementById?1:0this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;this.ie4=(document.all && !this.dom)?1:0;this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;this.ns4=(yers && !this.dom)?1:0;this.mac=(this.ver.indexOf('Mac') > -1) ?1:0;this.ope=(erAgent.indexOf('Opera')>-1);this.ie=(this.ie6 || this.ie5 || this.ie4)this.ns=(this.ns4 || this.ns5)this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns5 || this.ns4 || this.mac || this.ope)this.nbw=(!this.bw)return this;}/*******************************************日期函数扩充*******************************************//*===========================================//转换成大写日期(中文)===========================================*/Date.prototype.toCase = function(){var digits= new Array('零','一','二','三','四','五','六','七','八','九','十','十一','十二');var unit= new Array('年','月','日','点','分','秒');var year= this.getYear() + "";var index;var output="";////////得到年for (index=0;index<year.length;index++ ){output += digits[parseInt(year.substr(index,1))];}output +=unit[0];///////得到月output +=digits[this.getMonth()] + unit[1];///////得到日switch (parseInt(this.getDate() / 10)){case 0:output +=digits[this.getDate() % 10];break;case 1:output +=digits[10] + ((this.getDate() %10)>0?digits[(this.getDate() % 10)]:"");break;case 2:case 3:output +=digits[parseInt(this.getDate() / 10)] + digits[10] + ((this.getDate() % 10)>0?digits[(this.getDate() % 10)]:""); default:break;}output +=unit[2];///////得到时switch (parseInt(this.getHours() / 10)){case 0:output +=digits[this.getHours() % 10];break;case 1:output +=digits[10] + ((this.getHours() %10)>0?digits[(this.getHours() % 10)]:"");break;case 2:output +=digits[parseInt(this.getHours() / 10)] + digits[10] +((this.getHours() % 10)>0?digits[(this.getHours() % 10)]:""); break;}output +=unit[3];if(this.getMinutes()==0&&this.getSeconds()==0){output +="整";return output;}///////得到分switch (parseInt(this.getMinutes() / 10)){case 0:output +=digits[this.getMinutes() % 10];break;case 1:output +=digits[10] + ((this.getMinutes() %10)>0?digits[(this.getMinutes() % 10)]:"");break;case 2:case 3:case 4:case 5:output +=digits[parseInt(this.getMinutes() / 10)] + digits[10] + ((this.getMinutes() % 10)>0?digits[(this.getMinutes() % 10)]:""); break;}output +=unit[4];if(this.getSeconds()==0){output +="整";return output;}///////得到秒switch (parseInt(this.getSeconds() / 10)){case 0:output +=digits[this.getSeconds() % 10];break;case 1:output +=digits[10] + ((this.getSeconds() %10)>0?digits[(this.getSeconds() % 10)]:"");break;case 2:case 3:case 4:case 5:output +=digits[parseInt(this.getSeconds() / 10)] + digits[10] + ((this.getSeconds() % 10)>0?digits[(this.getSeconds() % 10)]:""); break;}output +=unit[5];return output;}/*===========================================//转换成农历===========================================*/Date.prototype.toChinese = function(){//暂缺}/*===========================================//是否是闰年===========================================*/Date.prototype.isLeapYear = function(){return(0==this.getYear()%4&&((this.getYear()%100!=0)||(this.getYear()%400== 0)));}/*===========================================//获得该月的天数===========================================*/Date.prototype.getDayCountInMonth = function(){var mon = new Array(12);mon[0] = 31; mon[1] = 28; mon[2] = 31; mon[3] = 30; mon[4] = 31; mon[5] = 30;mon[6] = 31; mon[7] = 31; mon[8] = 30; mon[9] = 31; mon[10] = 30; mon[11] = 31;if(0==this.getYear()%4&&((this.getYear()%100!=0)||(this.getYear()%400 ==0))&&this.getMonth()==2){return 29;}else{return mon[this.getMonth()];}}/*===========================================//日期比较===========================================*/pare = function(objDate){if(typeof(objDate)!="object" && objDate.constructor != Date){return -2;}var d = this.getTime() - objDate.getTime();if(d>0){return 1;}else if(d==0){return 0;}else{return -1;}}/*===========================================//格式化日期格式===========================================*/Date.prototype.Format = function(formatStr){var str = formatStr;str=str.replace(/yyyy|YYYY/,this.getFullYear());str=str.replace(/yy|YY/,(this.getYear() % 100)>9?(this.getYear() % 100).toString():"0" + (this.getYear() % 100));str=str.replace(/MM/,this.getMonth()>9?this.getMonth().toString():"0" + this.getMonth());str=str.replace(/M/g,this.getMonth());str=str.replace(/dd|DD/,this.getDate()>9?this.getDate().toString():"0 " + this.getDate());str=str.replace(/d|D/g,this.getDate());str=str.replace(/hh|HH/,this.getHours()>9?this.getHours().toString(): "0" + this.getHours());str=str.replace(/h|H/g,this.getHours());str=str.replace(/mm/,this.getMinutes()>9?this.getMinutes().toString() :"0" + this.getMinutes());str=str.replace(/m/g,this.getMinutes());str=str.replace(/ss|SS/,this.getSeconds()>9?this.getSeconds().toStrin g():"0" + this.getSeconds());str=str.replace(/s|S/g,this.getSeconds());return str;}/*===========================================//由字符串直接实例日期对象===========================================*/Date.prototype.instanceFromString = function(str){return new Date("2004-10-10".replace(/-/g, "\/"));}/*===========================================//得到日期年月日等加数字后的日期===========================================*/Date.prototype.dateAdd = function(interval,number){var date = this;switch(interval){case "y" :date.setFullYear(date.getFullYear()+number);return date;case "q" :date.setMonth(date.getMonth()+number*3);return date;case "m" :date.setMonth(date.getMonth()+number);return date;case "w" :date.setDate(date.getDate()+number*7);return date;case "d" :date.setDate(date.getDate()+number);return date;case "h" :date.setHours(date.getHours()+number);return date;case "m" :date.setMinutes(date.getMinutes()+number);return date;case "s" :date.setSeconds(date.getSeconds()+number);return date;default :date.setDate(d.getDate()+number);return date;}}/*===========================================//计算两日期相差的日期年月日等===========================================*/Date.prototype.dateDiff = function(interval,objDate){//暂缺}/*******************************************数字函数扩充*******************************************//*===========================================//转换成中文大写数字===========================================*/Number.prototype.toChinese = function(){var num = this;if(!/^\d*(\.\d*)?$/.test(num)){alert("Number is wrong!"); return "Number is wrong!";}var AA = new Array("零","壹","贰","叁","肆","伍","陆","柒","捌","玖");var BB = new Array("","拾","佰","仟","萬","億","点","");var a = (""+ num).replace(/(^0*)/g, "").split("."), k = 0, re = "";for(var i=a[0].length-1; i>=0; i--){switch(k){case 0 : re = BB[7] + re; break;case 4 : if(!new RegExp("0{4}\\d{"+(a[0].length-i-1) +"}$").test(a[0]))re = BB[4] + re; break;case 8 : re = BB[5] + re; BB[7] = BB[5]; k = 0; break;}if(k%4 == 2 && a[0].charAt(i+2) != 0 &&a[0].charAt(i+1) == 0) re = AA[0] + re;if(a[0].charAt(i) != 0) re = AA[a[0].charAt(i)] +BB[k%4] + re; k++;}if(a.length>1) //加上小数部分(如果有小数部分){re += BB[6];for(var i=0; i<a[1].length; i++) re +=AA[a[1].charAt(i)];}return re;}/*===========================================//保留小数点位数===========================================*/Number.prototype.toFixed=function(len){if(isNaN(len)||len==null){len = 0;}else{if(len<0){len = 0;}}return Math.round(this * Math.pow(10,len)) / Math.pow(10,len); }/*===========================================//转换成大写金额===========================================*/Number.prototype.toMoney = function(){// Constants:var MAXIMUM_NUMBER = 99999999999.99;// Predefine the radix characters and currency symbols for output: var CN_ZERO= "零";var CN_ONE= "壹";var CN_TWO= "贰";var CN_THREE= "叁";var CN_FOUR= "肆";var CN_FIVE= "伍";var CN_SIX= "陆";var CN_SEVEN= "柒";var CN_EIGHT= "捌";var CN_NINE= "玖";var CN_TEN= "拾";var CN_HUNDRED= "佰";var CN_THOUSAND = "仟";var CN_TEN_THOUSAND= "万";var CN_HUNDRED_MILLION= "亿";var CN_SYMBOL= "";var CN_DOLLAR= "元";var CN_TEN_CENT = "角";var CN_CENT= "分";var CN_INTEGER= "整";// Variables:var integral; // Represent integral part of digit number.var decimal; // Represent decimal part of digit number.var outputCharacters; // The output result.var parts;var digits, radices, bigRadices, decimals;var zeroCount;var i, p, d;var quotient, modulus;if (this > MAXIMUM_NUMBER){return "";}// Process the coversion from currency digits to characters:// Separate integral and decimal parts before processing coversion:parts = (this + "").split(".");if (parts.length > 1){integral = parts[0];decimal = parts[1];// Cut down redundant decimal digits that are after the second. decimal = decimal.substr(0, 2);}else{integral = parts[0];decimal = "";}// Prepare the characters corresponding to the digits:digits= new Array(CN_ZERO, CN_ONE, CN_TWO, CN_THREE, CN_FOUR, CN_FIVE, CN_SIX, CN_SEVEN, CN_EIGHT, CN_NINE);radices= new Array("", CN_TEN, CN_HUNDRED, CN_THOUSAND);bigRadices= new Array("", CN_TEN_THOUSAND, CN_HUNDRED_MILLION); decimals= new Array(CN_TEN_CENT, CN_CENT);// Start processing:outputCharacters = "";// Process integral part if it is larger than 0:if (Number(integral) > 0){zeroCount = 0;for (i = 0; i < integral.length; i++){p = integral.length - i - 1;d = integral.substr(i, 1);quotient = p / 4;modulus = p % 4;if (d == "0"){zeroCount++;}else{if (zeroCount > 0){outputCharacters += digits[0];}zeroCount = 0;outputCharacters += digits[Number(d)] + radices[modulus]; }if (modulus == 0 && zeroCount < 4){outputCharacters += bigRadices[quotient];}}outputCharacters += CN_DOLLAR;}// Process decimal part if there is:if (decimal != ""){for (i = 0; i < decimal.length; i++){d = decimal.substr(i, 1);if (d != "0"){outputCharacters += digits[Number(d)] + decimals[i];}}}// Confirm and return the final output string:if (outputCharacters == ""){outputCharacters = CN_ZERO + CN_DOLLAR;}if (decimal == ""){outputCharacters += CN_INTEGER;}outputCharacters = CN_SYMBOL + outputCharacters;return outputCharacters;}Number.prototype.toImage = function(){var num = Array("#define t_width 3\n#define t_height 5\nstatic char t_bits[] = {0xF,0x5,0x5,0x5,0xF}","#define t_width 3\n#define t_height 5\nstatic char t_bits[] = {0x4,0x4,0x4,0x4,0x4}","#define t_width 3\n#define t_height 5\nstatic char t_bits[] = {0xF,0x4,0xF,0x1,0xF}","#define t_width 3\n#define t_height 5\nstatic char t_bits[] = {0xF,0x4,0xF,0x4,0xF}","#define t_width 3\n#define t_height 5\nstatic char t_bits[] = {0x5,0x5,0xF,0x4,0x4}","#define t_width 3\n#define t_height 5\nstatic char t_bits[] = {0xF,0x1,0xF,0x4,0xF}","#define t_width 3\n#define t_height 5\nstatic char t_bits[] = {0xF,0x1,0xF,0x5,0xF}","#define t_width 3\n#define t_height 5\nstatic char t_bits[] = {0xF,0x4,0x4,0x4,0x4}","#define t_width 3\n#define t_height 5\nstatic char t_bits[] = {0xF,0x5,0xF,0x5,0xF}","#define t_width 3\n#define t_height 5\nstatic char t_bits[] = {0xF,0x5,0xF,0x4,0xF}");var str = this + "";var iIndexvar result=""for(iIndex=0;iIndex<str.length;iIndex++){result +="<img src='javascript:" & num(iIndex) & "'">}return result;}/*******************************************其他函数扩充*******************************************//*===========================================//验证类函数===========================================*/function IsEmpty(obj){obj=document.getElementsByName(obj).item(0);if(Trim(obj.value)==""){if(obj.disabled==false && obj.readOnly==false){obj.focus();}return true;}else{return false;}}/*===========================================//无模式提示对话框===========================================*/function modelessAlert(Msg){window.showModelessDialog("javascript:alert(\""+escape(Msg)+"\") ;window.close();","","status:no;resizable:no;help:no;dialogHeight:hei ght:30px;dialogHeight:40px;");}/*===========================================//页面里回车到下一控件的焦点===========================================*/function Enter2Tab(){var e = document.activeElement;if(e.tagName == "INPUT" &&(e.type == "text" ||e.type == "password" ||e.type == "checkbox" ||e.type == "radio") ||e.tagName == "SELECT"){if(window.event.keyCode == 13){window.event.keyCode = 9;}}}////////打开此功能请取消下行注释//document.onkeydown = Enter2Tab;function ViewSource(url){window.location = 'view-source:'+ url;}///////禁止右键document.oncontextmenu = function() { return false;}/*******************************************字符串函数扩充*******************************************//*===========================================//去除左边的空格===========================================*/String.prototype.LTrim = function(){return this.replace(/(^\s*)/g, "");}String.prototype.Mid = function(start,len) {if(isNaN(start)&&start<0){return "";}if(isNaN(len)&&len<0){return "";}return this.substring(start,len);}/*=========================================== //去除右边的空格=========================================== */String.prototype.Rtrim = function(){return this.replace(/(\s*$)/g, "");}/*=========================================== //去除前后空格=========================================== */String.prototype.Trim = function(){return this.replace(/(^\s*)|(\s*$)/g, "");}/*===========================================//得到左边的字符串===========================================*/String.prototype.Left = function(len){if(isNaN(len)||len==null){len = this.length;}else{if(parseInt(len)<0||parseInt(len)>this.length) {len = this.length;}}return this.substring(0,len);}/*===========================================//得到右边的字符串===========================================*/String.prototype.Right = function(len){if(isNaN(len)||len==null){len = this.length;}else{if(parseInt(len)<0||parseInt(len)>this.length){len = this.length;}}return this.substring(this.length-len,this.length); }/*===========================================//得到中间的字符串,注意从0开始===========================================*/String.prototype.Mid = function(start,len){if(isNaN(start)||start==null){start = 0;}else{if(parseInt(start)<0){start = 0;}}if(isNaN(len)||len==null){len = this.length;}else{if(parseInt(len)<0){len = this.length;}}return this.substring(start,start+len);}/*=========================================== //在字符串里查找另一字符串:位置从0开始=========================================== */String.prototype.InStr = function(str){if(str==null){str = "";}return this.indexOf(str);}/*=========================================== //在字符串里反向查找另一字符串:位置0开始=========================================== */String.prototype.InStrRev = function(str) {if(str==null){str = "";}return stIndexOf(str);}/*===========================================//计算字符串打印长度===========================================*/String.prototype.LengthW = function(){return this.replace(/[^\x00-\xff]/g,"**").length; }/*===========================================//是否是正确的IP地址===========================================*/String.prototype.isIP = function(){var reSpaceCheck = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/;if (reSpaceCheck.test(this)){this.match(reSpaceCheck);if (RegExp.$1 <= 255 && RegExp.$1 >= 0&& RegExp.$2 <= 255 && RegExp.$2 >= 0&& RegExp.$3 <= 255 && RegExp.$3 >= 0&& RegExp.$4 <= 255 && RegExp.$4 >= 0){return true;}else{return false;}}else{return false;}}/*===========================================//是否是正确的长日期===========================================*/String.prototype.isDate = function(){var r = str.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})(\d{1,2}):(\d{1,2}):(\d{1,2})$/);if(r==null){return false;}var d = new Date(r[1], r[3]-1,r[4],r[5],r[6],r[7]);return(d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]&&d. getHours()==r[5]&&d.getMinutes()==r[6]&&d.getSeconds()==r[7]);}/*===========================================//是否是手机===========================================*/String.prototype.isMobile = function(){return /^0{0,1}13[0-9]{9}$/.test(this);}/*===========================================//是否是邮件===========================================*/String.prototype.isEmail = function(){return /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(this);}/*===========================================//是否是邮编(中国)===========================================*/String.prototype.isZipCode = function(){return /^[\\d]{6}$/.test(this);}/*===========================================//是否是有汉字===========================================*/String.prototype.existChinese = function(){//[\u4E00-\u9FA5]為漢字﹐[\uFE30-\uFFA0]為全角符號return /^[\x00-\xff]*$/.test(this);}/*===========================================//是否是合法的文件名/目录名===========================================*/String.prototype.isFileName = function(){return !/[\\\/\*\?\|:"<>]/g.test(this);}/*===========================================//是否是有效链接===========================================*/String.Prototype.isUrl = function(){return /^http:\/\/([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$/.test(this); }/*===========================================//是否是有效的身份证(中国)===========================================*/String.prototype.isIDCard = function(){var iSum=0;var info="";var sId = this;var aCity={11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",21:"辽宁",22:"吉林",23:"黑龙江",31:"上海",32:"江苏",33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",42:"湖北",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",51:"四川",52:"贵州",53:"云南",54:"西藏",61:"陕西",62:"甘肃",63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外"};if(!/^\d{17}(\d|x)$/i.test(sId)){return false;}sId=sId.replace(/x$/i,"a");//非法地区if(aCity[parseInt(sId.substr(0,2))]==null){return false;}var sBirthday=sId.substr(6,4)+"-"+Number(sId.substr(10,2))+"-"+Number(sId.substr(12,2));var d=new Date(sBirthday.replace(/-/g,"/"))//非法生日if(sBirthday!=(d.getFullYear()+"-"+ (d.getMonth()+1) + "-" +d.getDate())){return false;}for(var i = 17;i>=0;i--){iSum += (Math.pow(2,i) % 11) * parseInt(sId.charAt(17 - i),11);}if(iSum%11!=1){return false;}return true;}/*===========================================//是否是有效的电话号码(中国)===========================================*/String.prototype.isPhoneCall = function(){return /(^[0-9]{3,4}\-[0-9]{3,8}$)|(^[0-9]{3,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}13[0-9]{9}$)/.test(this); }/*=========================================== //是否是数字=========================================== */String.prototype.isNumeric = function(flag) {//验证是否是数字if(isNaN(this)){return false;}switch(flag){case null://数字case "":return true;case "+"://正数return/(^\+?|^\d?)\d*\.?\d+$/.test(this); case "-"://负数return/^-\d*\.?\d+$/.test(this);case "i"://整数return/(^-?|^\+?|\d)\d+$/.test(this);case "+i"://正整数return/(^\d+$)|(^\+?\d+$)/.test(this);case "-i"://负整数return/^[-]\d+$/.test(this);case "f"://浮点数return/(^-?|^\+?|^\d?)\d*\.\d+$/.test(this); case "+f"://正浮点数return/(^\+?|^\d?)\d*\.\d+$/.test(this); case "-f"://负浮点数return/^[-]\d*\.\d$/.test(this);default://缺省return true;}}/*===========================================//转换成全角===========================================*/String.prototype.toCase = function(){var tmp = "";for(var i=0;i<this.length;i++){if(this.charCodeAt(i)>0&&this.charCodeAt(i)<255){tmp += String.fromCharCode(this.charCodeAt(i)+65248); }else{tmp += String.fromCharCode(this.charCodeAt(i));}}return tmp}/*===========================================//对字符串进行Html编码===========================================*/String.prototype.toHtmlEncode = function{var str = this;str=str.replace("&","&amp;");str=str.replace("<","&lt;");str=str.replace(">","&gt;");str=str.replace("'","&apos;");str=str.replace("\"","&quot;");return str;}qqdao(青青岛)精心整理的输入判断js函数关键词:字符串判断,字符串处理,字串判断,字串处理//'*********************************************************// ' Purpose: 判断输入是否为整数字// ' Inputs: String// ' Returns: True, False//'********************************************************* function onlynumber(str){var i,strlength,tempchar;str=CStr(str);if(str=="") return false;strlength=str.length;for(i=0;i<strlength;i++){tempchar=str.substring(i,i+1);if(!(tempchar==0||tempchar==1||tempchar==2||tempchar== 3||tempchar==4||tempchar==5||tempchar==6||tempchar==7||tempchar==8||t empchar==9)){alert("只能输入数字");return false;}}return true;}//'*********************************************************//'*********************************************************// ' Purpose: 判断输入是否为数值(包括小数点)// ' Inputs: String// ' Returns: True, False//'********************************************************* function IsFloat(str){ var tmp;var temp;var i;tmp =str;if(str=="") return false;for(i=0;i<tmp.length;i++){temp=tmp.substring(i,i+1);if((temp>='0'&& temp<='9')||(temp=='.')){} //check input in 0-9 and '.'else { return false;}}return true;}//'*********************************************************// ' Purpose: 判断输入是否为电话号码// ' Inputs: String// ' Returns: True, False//'********************************************************* function isphonenumber(str){var i,strlengh,tempchar;str=CStr(str);if(str=="") return false;strlength=str.length;for(i=0;i<strlength;i++){tempchar=str.substring(i,i+1);if(!(tempchar==0||tempchar==1||tempchar==2||tempchar== 3||tempchar==4||tempchar==5||tempchar==6||tempchar==7||tempchar==8||t empchar==9||tempchar=='-')){alert("电话号码只能输入数字和中划线");return(false);}}return(true);}//'*********************************************************//'*********************************************************// ' Purpose: 判断输入是否为Email// ' Inputs: String// ' Returns: True, False//'********************************************************* function isemail(str){var bflag=trueif (str.indexOf("'")!=-1) {bflag=false}if (str.indexOf("@")==-1) {bflag=false}else if(str.charAt(0)=="@"){bflag=false}return bflag}//'*********************************************************// ' Purpose: 判断输入是否含有为中文。

JAVA代码大全

JAVA代码大全


UNCODE 编码
escape() ,unescape

父对象
obj.parentElement(dhtml)
obj.parentNode(dom)

交换表的行
TableID.moveRow(2,1)

替换 CSS
document.all.csss.href = "a.css";

并排显示
display:inline
//过滤数字
<input type=text onkeypress="return event.keyCode>=48&&event.keyCode<=57||(t his.value.indexOf(‘.‘)<0?event.keyCode==46:false)" onpaste="return !clipboar dData.getData(‘text‘).match(/\D/)" ondragenter="return false">
encodeURIComponent 对":"、"/"、";" 和 "?"也编码

表格行指示
<tr onmouseover="this.bgColor=‘#f0f0f0‘" onmouseout="this.bgColor=‘#ffffff‘">
//各种尺寸
s += "\r\n 网页可见区域宽:"+ document.body.clientWidth; s += "\r\n 网页可见区域高:"+ document.body.clientHeight; s += "\r\n 网页可见区域高:"+ document.body.offsetWeight +" (包括边线的宽)"; s += "\r\n 网页可见区域高:"+ document.body.offsetHeight +" (包括边线的宽)"; s += "\r\n 网页正文全文宽:"+ document.body.scrollWidth; s += "\r\n 网页正文全文高:"+ document.body.scrollHeight; s += "\r\n 网页被卷去的高:"+ document.body.scrollTop; s += "\r\n 网页被卷去的左:"+ document.body.scrollLeft; s += "\r\n 网页正文部分上:"+ window.screenTop; s += "\r\n 网页正文部分左:"+ window.screenLeft; s += "\r\n 屏幕分辨率的高:"+ window.screen.height; s += "\r\n 屏幕分辨率的宽:"+ window.screen.width; s += "\r\n 屏幕可用工作区高度:"+ window.screen.availHeight; s += "\r\n 屏幕可用工作区宽度:"+ window.screen.availWidth;

java常用代码(20条案例)

java常用代码(20条案例)

java常用代码(20条案例)1. 输出Hello World字符串public class Main {public static void main(String[] args) {// 使用System.out.println()方法输出字符串"Hello World"System.out.println("Hello World");}}2. 定义一个整型变量并进行赋值public class Main {public static void main(String[] args) {// 定义一个名为num的整型变量并将其赋值为10int num = 10;// 使用System.out.println()方法输出变量num的值System.out.println(num);}}3. 循环打印数字1到10public class Main {public static void main(String[] args) {// 使用for循环遍历数字1到10for (int i = 1; i <= 10; i++) {// 使用System.out.println()方法输出每个数字System.out.println(i);}}}4. 实现输入输出import java.util.Scanner;public class Main {public static void main(String[] args) {// 创建一个Scanner对象scanner,以便接受用户的输入Scanner scanner = new Scanner(System.in);// 使用scanner.nextLine()方法获取用户输入的字符串String input = scanner.nextLine();// 使用System.out.println()方法输出输入的内容System.out.println("输入的是:" + input);}}5. 实现条件分支public class Main {public static void main(String[] args) {// 定义一个整型变量num并将其赋值为10int num = 10;// 使用if语句判断num是否大于0,如果是,则输出"这个数是正数",否则输出"这个数是负数"if (num > 0) {System.out.println("这个数是正数");} else {System.out.println("这个数是负数");}}}6. 使用数组存储数据public class Main {public static void main(String[] args) {// 定义一个整型数组nums,其中包含数字1到5int[] nums = new int[]{1, 2, 3, 4, 5};// 使用for循环遍历数组for (int i = 0; i < nums.length; i++) {// 使用System.out.println()方法输出每个数组元素的值System.out.println(nums[i]);}}}7. 打印字符串长度public class Main {public static void main(String[] args) {// 定义一个字符串变量str并将其赋值为"HelloWorld"String str = "Hello World";// 使用str.length()方法获取字符串的长度,并使用System.out.println()方法输出长度System.out.println(str.length());}}8. 字符串拼接public class Main {public static void main(String[] args) {// 定义两个字符串变量str1和str2,并分别赋值为"Hello"和"World"String str1 = "Hello";String str2 = "World";// 使用"+"号将两个字符串拼接成一个新字符串,并使用System.out.println()方法输出拼接后的结果System.out.println(str1 + " " + str2);}}9. 使用方法进行多次调用public class Main {public static void main(String[] args) {// 定义一个名为str的字符串变量并将其赋值为"Hello World"String str = "Hello World";// 调用printStr()方法,打印字符串变量str的值printStr(str);// 调用add()方法,计算两个整数的和并输出结果int result = add(1, 2);System.out.println(result);}// 定义一个静态方法printStr,用于打印字符串public static void printStr(String str) {System.out.println(str);}// 定义一个静态方法add,用于计算两个整数的和public static int add(int a, int b) {return a + b;}}10. 使用继承实现多态public class Main {public static void main(String[] args) {// 创建一个Animal对象animal,并调用move()方法Animal animal = new Animal();animal.move();// 创建一个Dog对象dog,并调用move()方法Dog dog = new Dog();dog.move();// 创建一个Animal对象animal2,但其实际指向一个Dog对象,同样调用move()方法Animal animal2 = new Dog();animal2.move();}}// 定义一个Animal类class Animal {public void move() {System.out.println("动物在移动");}}// 定义一个Dog类,继承自Animal,并重写了move()方法class Dog extends Animal {public void move() {System.out.println("狗在奔跑");}}11. 输入多个数并求和import java.util.Scanner;public class Main {public static void main(String[] args) {// 创建一个Scanner对象scanner,以便接受用户的输入Scanner scanner = new Scanner(System.in);// 定义一个整型变量sum并将其赋值为0int sum = 0;// 使用while循环持续获取用户输入的整数并计算总和,直到用户输入为0时结束循环while (true) {System.out.println("请输入一个整数(输入0退出):");int num = scanner.nextInt();if (num == 0) {break;}sum += num;}// 使用System.out.println()方法输出总和System.out.println("所有输入的数的和为:" + sum);}}12. 判断一个年份是否为闰年import java.util.Scanner;public class Main {public static void main(String[] args) {// 创建一个Scanner对象scanner,以便接受用户的输入Scanner scanner = new Scanner(System.in);// 使用scanner.nextInt()方法获取用户输入的年份System.out.println("请输入一个年份:");int year = scanner.nextInt();// 使用if语句判断年份是否为闰年,如果是,则输出"是闰年",否则输出"不是闰年"if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {System.out.println(year + "年是闰年");} else {System.out.println(year + "年不是闰年");}}}13. 使用递归实现斐波那契数列import java.util.Scanner;public class Main {public static void main(String[] args) {// 创建一个Scanner对象scanner,以便接受用户的输入Scanner scanner = new Scanner(System.in);// 使用scanner.nextInt()方法获取用户输入的正整数nSystem.out.println("请输入一个正整数:");int n = scanner.nextInt();// 使用for循环遍历斐波那契数列for (int i = 1; i <= n; i++) {System.out.print(fibonacci(i) + " ");}}// 定义一个静态方法fibonacci,使用递归计算斐波那契数列的第n项public static int fibonacci(int n) {if (n <= 2) {return 1;} else {return fibonacci(n - 1) + fibonacci(n - 2);}}}14. 输出九九乘法表public class Main {public static void main(String[] args) {// 使用两层for循环打印九九乘法表for (int i = 1; i <= 9; i++) {for (int j = 1; j <= i; j++) {System.out.print(j + "*" + i + "=" + (i * j) + "\t");}System.out.println();}}}15. 使用try-catch-finally处理异常import java.util.Scanner;public class Main {public static void main(String[] args) {// 创建一个Scanner对象scanner,以便接受用户的输入Scanner scanner = new Scanner(System.in);try {// 使用scanner.nextInt()方法获取用户输入的整数a和bSystem.out.println("请输入两个整数:");int a = scanner.nextInt();int b = scanner.nextInt();// 对a进行除以b的运算int result = a / b;// 使用System.out.println()方法输出结果System.out.println("计算结果为:" + result);} catch (ArithmeticException e) {// 如果除数为0,会抛出ArithmeticException异常,捕获异常并使用System.out.println()方法输出提示信息System.out.println("除数不能为0");} finally {// 使用System.out.println()方法输出提示信息System.out.println("程序结束");}}}16. 使用集合存储数据并遍历import java.util.ArrayList;import java.util.List;public class Main {public static void main(String[] args) {// 创建一个名为list的List集合,并添加多个字符串元素List<String> list = new ArrayList<>();list.add("Java");list.add("Python");list.add("C++");list.add("JavaScript");// 使用for循环遍历List集合并使用System.out.println()方法输出每个元素的值for (int i = 0; i < list.size(); i++) {System.out.println(list.get(i));}}}17. 使用Map存储数据并遍历import java.util.HashMap;import java.util.Map;public class Main {public static void main(String[] args) {// 创建一个名为map的Map对象,并添加多组键值对Map<Integer, String> map = new HashMap<>();map.put(1, "Java");map.put(2, "Python");map.put(3, "C++");map.put(4, "JavaScript");// 使用for-each循环遍历Map对象并使用System.out.println()方法输出每个键值对的值for (Map.Entry<Integer, String> entry :map.entrySet()) {System.out.println("key=" + entry.getKey() + ", value=" + entry.getValue());}}}18. 使用lambda表达式进行排序import java.util.ArrayList;import java.util.Collections;import parator;import java.util.List;public class Main {public static void main(String[] args) {// 创建一个名为list的List集合,并添加多个字符串元素List<String> list = new ArrayList<>();list.add("Java");list.add("Python");list.add("C++");list.add("JavaScript");// 使用lambda表达式定义Comparator接口的compare()方法,按照字符串长度进行排序Comparator<String> stringLengthComparator = (s1, s2) -> s1.length() - s2.length();// 使用Collections.sort()方法将List集合进行排序Collections.sort(list, stringLengthComparator);// 使用for-each循环遍历List集合并使用System.out.println()方法输出每个元素的值for (String str : list) {System.out.println(str);}}}19. 使用线程池执行任务import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;public class Main {public static void main(String[] args) {// 创建一个名为executor的线程池对象,其中包含2个线程ExecutorService executor =Executors.newFixedThreadPool(2);// 使用executor.execute()方法将多个Runnable任务加入线程池中进行执行executor.execute(new MyTask("任务1"));executor.execute(new MyTask("任务2"));executor.execute(new MyTask("任务3"));// 调用executor.shutdown()方法关闭线程池executor.shutdown();}}// 定义一个MyTask类,实现Runnable接口,用于代表一个任务class MyTask implements Runnable {private String name;public MyTask(String name) { = name;}@Overridepublic void run() {System.out.println("线程" +Thread.currentThread().getName() + "正在执行任务:" + name);try {Thread.sleep(2000);} catch (InterruptedException e) {e.printStackTrace();}System.out.println("线程" +Thread.currentThread().getName() + "完成任务:" + name);}}20. 使用JavaFX创建图形用户界面import javafx.application.Application;import javafx.scene.Scene;import javafx.scene.control.Button;import yout.StackPane;import javafx.stage.Stage;public class Main extends Application {@Overridepublic void start(Stage primaryStage) throws Exception { // 创建一个Button对象btn,并设置按钮名称Button btn = new Button("点击我");// 创建一个StackPane对象pane,并将btn添加到pane中StackPane pane = new StackPane();pane.getChildren().add(btn);// 创建一个Scene对象scene,并将pane作为参数传入Scene scene = new Scene(pane, 200, 100);// 将scene设置为primaryStage的场景primaryStage.setScene(scene);// 将primaryStage的标题设置为"JavaFX窗口"primaryStage.setTitle("JavaFX窗口");// 调用primaryStage.show()方法显示窗口primaryStage.show();}public static void main(String[] args) { launch(args);}}。

java基础知识大全(必看经典)

java基础知识大全(必看经典)

第一讲 Java语言入门1.1 Java的特点面向对象:•与C++相比,JAVA是纯的面向对象的语言C++为了向下兼容C,保存了很多C里面的特性,而C,众所周知是面向过程的语言,这就使C++成为一个"混血儿"。

而JAVA语法中取消了C++里为兼容C所保存的特性,如取消了头文件、指针算法、结构、单元等。

可移植〔平台无关性〕:•生成中间字节码指令与其他编程语言不同,Java并不生成可执行文件〔.exe文件〕,而是生成一种中间字节码文件〔.class文件〕。

任何操作系统,只要装有Java虚拟机〔JVM〕,就可以解释并执行这个中间字节码文件。

这正是Java实现可移植的机制。

•原始数据类型存储方法固定,避开移植时的问题Java的原始数据类型的大小是固定的。

比方,在任何机器上,整型都是32位,而C++里整型是依赖于目标机器的,对16位处理器〔比方8086〕,整数用两个字节表示;在像Sun SPARC这样的32位处理器中,整数用4个字节表示。

在Intel Pentium处理器上,整数类型由具体的操作系统决定:对于DOS和Win32来说,整数是2个字节;对于Windows 9x 、NT和2000,整数是4个字节。

当然,使整数类型平台无关之后,性能必然有所下降,但就Java来说,这个代价是值得的。

Java的字符串,那么采用标准的Unicode格式保存。

可以说,没有这个特性,Java的可移植性也不可能实现。

简单•JAVA在语法上与C++类似JAVA的语法与C++很接近,有过C或者C++编程经验的程序员很容易就可以学会JAVA语法;•取消了C++的一些复杂而低效的特性比方:用接口技术代替了C++的多重继承。

C++中,一个类允许有多个超类,这个特性叫做"多重继承",多重继承使得编译器非常复杂且效率不高;JAVA 的类只允许有一个超类,而用接口〔Interface〕技术实现与C++的多继承相类似的功能其它被取消的特性包括:虚拟根底类、运算符过载等•JAVA的根本解释器和类支持模块大概仅40K即使参加根本的标准库和支持线程的模块,也才220K左右。

JAVA代码大全

JAVA代码大全

. 命令行参数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
方 法
. 输入方法演示 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. 统计学生成绩 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. ASCII 码表 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. 乘法表 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. Course . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. 整数栈 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
System.out.println(”Hello, World!”);
}
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

/*
1. 打印:--------------------------------------------------
2. 求两个浮点数之商。

3. 对一个数四舍五入取整。

4. 判断一个数是否为奇数
5. 求一个数的绝对值。

6. 求两个数的最大值。

7. 求三个数的最大值。

8. 求1-n之和。

9. 求1-n中的奇数之和。

10. 打印自2012年起,n年内的所有闰年。

11. 打印n行星号组成的等腰三角形。

12. 求两个正整数的最小公倍数。

13. 判断一个数是否为质数。

14. 求两个正整数的最大公约数。

15. 求一个正整数n以内的质数。

16. 求一个正整数n以内的质数。

17. 分别利用递推算法和递归算法求n! 。

*/
class A
{
static void f(){
System.out.println("----------------------");//1.打印:-----------
}
static double quzheng(double a){
int b;
System.out.println((b=(int)(a+0.5)));//2.求两个浮点数之商。

return(b);
}
static double qiushang(double a,double b){ //3.对一个数四舍五入取整System.out.println((a/b));
return(a/b);
}
static boolean odd(int c){ //4.判断一个数是否为奇数if(c%2==0){
return(false);
}
else{
return(true);
}
}
static int juedui(int d){ //5.求一个数的绝对值。

if(d<0){
d=0-d;
System.out.println(d);
}
else{
d=d;
System.out.println(d);
}
return(d);
}
static int max(int e,int f){ //6.求两个数的最大值。

if(e>f){
System.out.println(e);
return(e);
}
else{
System.out.println(f);
return(f);
}
}
static int maxt(int g,int h,int i){ //7.求三个数的最大值。

if(g>h&&g>i){
System.out.println(g);
return(g);
}
if(h>g&&h>i){
System.out.println(h);
return(h);
}
else{
System.out.println(i);
return i;
}
}
static int sum(int n){ //8.求1-n之和。

int s=0;
for(int i=1;i<=n;i++){
s+=i;
}
System.out.println(s);
return n;
}
static int sumx(int n){ //9.求1-n中的奇数之和int s=0;
for(int i=1;i<=n;i++){
if(i%2==0){
s=s;
}
else{
s+=i;
}
}
System.out.println(s);
return n;
}
static int run(int n){ //10.打印自2012年起,n年内的所有闰年。

//int i=2012;
for(int i=2012;i<=2012+n;i++){
if(i%400==0){
System.out.println(i);
}
else if(i%4==0&&i%100!=0){
System.out.println(i);
}
}
return n;
}
static void sanjiao(int n){ //11.打印n行星号组成的等腰三角形。

for(int i=1;i<=n;i++){
for(int j=1;j<=n-i;j++){
System.out.print(" ");
}
for(int j=1;j<=i*2-1;j++){
System.out.print("*");
}
System.out.println("");
}
}
static int gongbs(int x,int y){ //12.求两个正整数的最小公倍数。

for(int i=1;i<=x*y;i++){
if(i%x==0&&i%y==0){
System.out.println(i);
}
}
return (y);
}
static int gongys(int x,int y){ //14.求两个正整数的最大公约数。

while(x%y!=0){
int i=x%y;
x=y;
i=y;
}
System.out.println(y);
return (y);
}
static boolean zhishu(int x){ //13.判断一个数是否为质数
for(int i=2;i<x;i++){
if(x%i==0){
return(false);
}
else{
return(true);
}
}
return(true);
}
static int sumz(int n){ //15.求一个正整数n以内的质数。

int s=0;
for(int i=2;i<n;i++){
if(n%i==0){
s=s;
}
else {
s+=n;
}
}
System.out.println(s);
return n;
}
static int fib(int n){ //16.求一个正整数n以内的质数。

if(n==1)
return n=1;
return n=fib(n-1)+n;
}
public static void main(String[] args)
{
f();
quzheng(1.3);
qiushang(12.2,3);
boolean ok=odd(3);
System.out.println(ok);
juedui(-4);
max(3,8);
maxt(12,13,14);
sum(3);
sumx(3);
run(8);
sanjiao(10);
gongbs(4,5);
gongys(25,5);
boolean zs=zhishu(10);
System.out.println(zs);
sumz(10);
fib(10);
int i=fib(12);
System.out.println(i);
}
}。

相关文档
最新文档