03 2013 档案
摘要:public class Example4_18{public static void main(String args[]){char a[]={'a','b','c','D','E','F'};for(int i=0;i<a.length;i++){ if(Character.isLowerCase(a[i])){ a[i]=Character.toUpperCase(a[i]); } else if(Character.isUpperCase(a[i])){ a[i]=Character
阅读全文
摘要:public class Rectangle{private double x,y,width,height;public void setX(double x){this.x=x;}public double getX(){return x;}public void setY(double y){this.y=y;}public double getY(){return y;}public void setWidth(double width){if(width<=0) this.width=0;else this.width=width;}public double getWidth
阅读全文
摘要:public class Example4_15{private int money;Example4_15 (){money =2000;}private int getMoney(){return money;}public static void main(String args[]){Example4_15 exa=new Example4_15();exa.money=3000;int m=exa.getMoney();System.out.println("money="+m);}}class Employee{private double salary=180
阅读全文
摘要:import java.text.SimpleDateFormat; import java.util.Date; public class Time { public static void main(String[] args) {SimpleDateFormat format = new SimpleDateFormat( "yyyy年-M月-d日 kk时:m分:ss秒 E "); String s = format.format(new Date()); System.out.println(s); }}
阅读全文
摘要:public class Tom{int leg;Tom(int n){this.cry();leg=n;this.cry();}void cry(){ System.out.println("我是Tom,我现在有"+leg+"条腿");}public static void main(String args[]){Tom cat=new Tom(4);}}import tom.jiafei.*;public class Example4_14{ public static void main(String args[]){ SquareEquation
阅读全文
摘要:class People{double getArea(double x,int y){return x*y;}int getArea(int x,double y){return (int)(x*y);}double getArea(float x,float y,float z){ return(x*x+y*y+z*z)*2.0;}}public class Example4_10{public static void main(String args[]){People zhang=new People();System.out.println("面积:"+zhang
阅读全文
摘要:class Circle{double radius;Circle(double r){radius=r;}double computerArea(){return 3.14*radius*radius;}void setRadius(double newRadius){radius=newRadius;}double getRadius(){return radius;}}class Cone{Circle bottom;double height;Cone(Circle c,double h){ bottom=c; height=h;}double computerVolume(){dou
阅读全文
摘要:class Tom{void f(int x,double y){ x=x+1; y=y+1;System.out.printf("参数x和y的值分别是:%d,%3.2f\n",x,y);}}public class Example4_7{ public static void main(String args[]){ int x=10; double y=12.58; Tom cat=new Tom(); cat.f(x,y); System.out.printf("main方法中x和y的值仍然分别是:%d,%3.2f\n",x,y);}}class
阅读全文
摘要:class Lader{double above,height;static double bottom;void setAbove(double a){above =a;} void setBottom(double b){ bottom =b;}double getAbove(){return above;}double getBottom(){return bottom; }} public class Example4_4{ public static void main(String args[]){ Lader.bottom=60; Lader laderOne,laderTwo;
阅读全文
摘要:public class ComputerCircleArea{public static void main(String args[]){double radius;double area;radius=163.16;area=3.14*radius*radius;System.out.printf("半径是%5.3f的圆的面积:\n%5.3f\n",radius,area);}}class Circle{double radius;double getArea(){ double area=3.14*radius*radius; return area;}}publi
阅读全文
摘要:public class Example3_7{ public static void main(String args[]){ int sum=0,i=0,max=8888,number=7; while(true){ i++; sum=sum+i; if(sum>=max) break; } System.out.println("1+2+...n<"+max+"的最大整数n是:"+(i-1)); for(i=1,max=200,sum=0;i<=max;i++){ if(i%number!=0){ continue; } sum=
阅读全文
摘要:public class Example3_5{public static void main(String args[]){ double sum=0,item=1; int i=1; while(i<=1000){ sum=sum+item; i++; item=item*(1.0/i); } sum=sum+1; System.out.println("e="+sum); sum=0; i=1; item=1; do{ sum=sum+item; i++; item=item*(1.0/i); }while(i<=1000); sum=sum+1; Sys
阅读全文
摘要:import java.util.*;public class Example3_3{ public static void main(String args[]){ Scanner reader=new Scanner(System.in); double a=0,b=0,c=0; System.out.print("输入边a:"); a=reader.nextDouble(); System.out.print("输入边b:"); b=reader.nextDouble(); System.out.print("输入边c:");
阅读全文
摘要:import java.util.*;public class A{public static void main(String args[]){ Scanner reader=new Scanner(System.in);???????????????? int mul=1; while(reader.hasNextInt()) { int x=reader.nextInt(); mul=mul*x; System.out.printf("%d整数的乘积为%d\n",mul);}}
阅读全文
摘要:import java.util.*;public class Example3_1{ public static void main(String args[]){ Scanner reader=new Scanner(System.in); System.out.println("输入待移位的int型整数:"); int x=reader.nextInt(); System.out.println("输入移位量:"); int n=reader.nextInt(); System.out.println("左移位的结果:"+(x&
阅读全文
摘要:public class Example2_3{ public static void main(String args[]){ char c='A'; float f=123.456789f; double d=123456.12345678; long x=5678; System.out.printf("%c%n%10.3f%n%f,%12d%n%d",c,f,d,x,x=x+2); }}import java.util.*;public class Example2_4{ public static void main(String args[]){
阅读全文
摘要:public class Example2_1{ public static void main (String args[]){ char c='α'; System.out.println("字母"+c+"在unicode表中的顺序位置:"+(int)c); System.out.println("字母表:"); for(int i=(int)c;i<c+25;i++){ System.out.print(""+(char)i); } } }public class Example2_2{
阅读全文
摘要:class A{ void f(){ System.out.println("I am A"); } } class B{}public class Hello{public static void main(String args[]){System.out.println("你好,很高兴学习java");A a=new A();a.f();}}public class Tom{ int leg; String head; void cry(String s){ System.out.println(s); }}class Example{ publi
阅读全文
摘要:1、首先上甲骨文公司的官方网站下载JDK的安装包,根据自己电脑的操作系统选择正确的版本下载。不知道下载地址的同学可以百度一下很快就能搜到2、用鼠标左键双击JDK安装包,会出现安装界面。3、其实上面那个步骤是在加载配置,为安装JDK做前期准备。4、我们选中“我接受该许可证协议中的条款”,“下一步”按钮将自动激活,然后点击该按钮,会出现自定义安装界面。5、可以根据需要选择不同的安装路径和安装内容。这里我们保持默认选择。点击“下一步”出现“正在安装”界面。6、等待进度条到100%的时候,又会跳出“自定义安装”界面,这个时候要安装的是语言支持插件。直接点击下一步。7、然后会出现浏览器关联选项,可以根据
阅读全文
摘要:首先java和cC++都是经典的语言,但是二者却有着惊人的相似,对于面向对象的思想如出一辙!但是C++却相对比java难点,一方面是因为指针和对象的建立与销毁,内存的分配C++要程序员自己处理,而且要编出高效的代码就需要一定的联系与经Java就不同,可以说是C++的精简版,对很多的处理都做了人性化的简化,更容易上手!C++对于底层通信,可以说了语言界的老大,而且API很全很丰富,大型的网游,游戏十之八九都是用它开发的。而Java注重于web开发(后来发展出来的),因为其与平台的无关性,所以今年飞速发展-----可能是web时代的带动!验的!
阅读全文