ImageVerifierCode 换一换
格式:DOCX , 页数:30 ,大小:20.44KB ,
资源ID:18939163      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/18939163.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(java马士兵源码Word格式文档下载.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

java马士兵源码Word格式文档下载.docx

1、 /m.scream(); public static void main(String args) /int i; System.out.println(furColor); Dog d = new Dog(); Mouse m = new Mouse(); d.catchMouse(m); HelloWorld hw = new HelloWorld();class Mouse int height;Count3Quit.javapublic class Count3Quit int a = new int500; for(int i=0; ia.length; i+) ai = 1; i

2、nt leftCount = 500; int countNum = 0; int index = 0; while(leftCount != 1) if(aindex = 1) countNum +; if(countNum = 3) countNum = 0; aindex = 0; leftCount -; index +; if(index = a.length) index = 0; if(ai = 1) System.out.println(i);Fab.javapublic class Fab System.out.println(f(-9); public static lon

3、g f(int index) if(index 1) System.out.println(invalid parameter! return -1; if(index = 1 | index = 2) return 1; long f1 = 1L; long f2 = 1L; long f = 0;index-2; f = f1 + f2; f1 = f2; f2 = f; return f;HelloWorld.javapublic class HelloWorld static int j = 9; public static void main(String asdfasf) /a;s

4、ldfkja;sdjf;asjdf;asjdf System.out.println(HW System.out.println(123); System.out.println(j); int i = 8; public static void m() class TT ListFile.javaimport java.io.*;public class ListFile File f = new File(d:test /* File files = f.listFiles(); for(File ff : files) System.out.println(ff.getName(); *

5、/ listChilds(f, 0); public static void listChilds(File f, int level) String preStr = ;level; i+) preStr += System.out.println(preStr + f.getName(); if(!f.isDirectory() return; File childs = f.listFiles();childs.length; listChilds(childsi, level + 1);MySearch.javapublic class MySearch public class ma

6、in(String args) int a = 2, 5, 99, 4, 6, 8, 7, 24, 12; int m = 6; if(ai = m) OddSum.javapublic class OddSum long result = 0; for(int i=1;=99; i+=2) result += i; result= + result);Point3D.javapublic class Point3D double x, y, z; public Point3D(double _x, double _y, double _z) x = _x; y = _y; z = _z; p

7、ublic void setX(double _x) public double distance() return x*x + y*y + z*z; Point3D p = new Point3D(1.2, 3.4, 5.8); p.setX(1.3); System.out.println(p.distance();TestAccess.javaT.javapublic class T int i; void m(int i) this.i = i; void m(short i) short this.i = 8; T t = new T(); t.m(5);TestBreak.java

8、public class TestBreak public static void main(String args) int stop = 4; for (int i = 1; i radius * radius) return false; else return true; public void setO(double x, double y) o.setX(x); o.setY(y); public Point getO() return o; public double getRadius() return radius; public void setRadius(double

9、r) radius = r; public double area() return 3.14 * radius * radius;public class TestCircle Circle c1 = new Circle(new Point(1.0,2.0), 2.0); Circle c2 = new Circle(5.0);c1:(+c1.getO().getX()+, +c1.getO().getY()+),+c1.getRadius();c2:+c2.getO().getX() +c2.getO().getY()+c2.getRadius();c1 area = +c1.area(

10、);+c2.area(); c1.setO(5,6); c2.setRadius(9.0);+c2.getO().getX()+ +c2.getO().getY()+ Point p1 = new Point(5.2, 6.3); System.out.println(c1.contains(p1); System.out.println(c1.contains(new Point(10.0,9.0);TestConstruct.javaclass Person2 private String location; Person2(String name) location = beijing

11、Person2(String name,String location) this.location = location; public String info() return name: location:+location;class Teacher extends Person2 private String capital; Teacher(String name, String capital) this(name, , capital); Teacher(String name, String location, String capital) super(name, loca

12、tion); this.capital = capital; return super.info() + capital: + capital;public class TestConstruct Teacher t = new Teacher(B, GG System.out.println(t.info();TestConvert2.javapublic class TestConvert2 int i=1,j=12; float f1=(float)0.1; /0.1f float f2=123; long l1 = 12345678,l2=8888888888L; double d1

13、= 2e20,d2=124; byte b1 = 1,b2 = 2,b3 = 127; j = j+10; i = i/10; i = (int)(i*0.1); char c1=a,c2=125; byte b = (byte)(b1-b2); char c = (char)(c1+c2-1); float f3 = f1+f2; float f4 = (float)(f1+f2*0.1); double d = d1*i+j; float f = (float)(d1*5+d2);TestConvert.javapublic class TestConvert public static

14、void main(String arg) int i1 = 123; int i2 = 456; double d1 = (i1+i2)*1.2;/系统将转换为double型运算 float f1 = (float)(i1+i2)*1.2);/需要加强制转换符 byte b1 = 67; byte b2 = 89; byte b3 = (byte)(b1+b2);/系统将转换为int型运算,需要强制转换符 System.out.println(b3); double d2 = 1e200; float f2 = (float)d2;/会产生溢出 System.out.println(f2);

15、 float f3 = 1.23f;/必须加f long l1 = 123; long l2 = 30000000000L;/必须加l float f = l1+l2+f3;/系统将转换为float型计算 long l = (long)f;/强制转换会舍去小数部分(不是四舍五入)TestDigitCount.javapublic class TestDigitCount int i = 34789; double d = 3478.9765; digitCount2(String.valueOf(i); digitCount2(String.valueOf(d); public static

16、void digitCount(String s) int index = s.indexOf(. if(index = -1) System.out.println(s.length(); else 整数: + index + n + 小数: + (s.length() - index - 1); public static void digitCount2(String s) String s1 = s.replace(., , String ss = s1.split( if(ss.length = 1) System.out.println(s1.length(); else if(s

17、s.length = 2) + ss0.length() + + ss1.length();Format Error!TestEqual.javapublic class TestEqual Integer i1 = new Integer(1); Integer i2 = new Integer(1); System.out.println(i1 = i2); System.out.println(i1.equals(i2); Mao m1 = new Mao(A Mao m2 = new Mao( System.out.println(m1 = m2); System.out.printl

18、n(m1.equals(m2);class Mao String name; String color; Mao(String n,String c) name = n; color = c; public boolean equals(Object obj) return true;TestFormat.javapublic class TestFormat public static viod main(String args) okhello int i = 8 + 9;10; System.out.println(i); public void m() public void m2() public void m3() public void m4() TestIF.javapublic class TestIF int i = 20; if(i 20) 20 else if (i =60TestInherit.javaclass FatherClass publ

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1