- 博客(13)
- 收藏
- 关注
转载 实例3.7
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.pr
2013-04-15 19:45:40 420
转载 实例3.8
import java.util.*;class Example3_8 { public static void main(String []args) { int n,start,end,middle; int a[] = {-2,1,4,5,8,12,17,23,45,56,90,100}; start = 0; end = a.length; middl
2013-04-15 19:45:00 504
转载 数组提升
class Promote { public static void main(String[]args) { int []t = {36,49,59,61,75,82,100}; promote(t); view(t); } public static void view(int[] x) { for(int i=0;i System.out.prin
2013-04-15 19:44:13 411
转载 数组排列
class ArraySort { public static void main(String[]args) { int[]x = new int[]{49,78,95,20,25,63,100}; sort(x); for(int i=0;i System.out.println(x[i]); } } public static void sort(
2013-04-15 19:40:38 400
转载 例子4.4
class Lader { double above , height; static double bottom; void setAbove(double a ) { above = a; } void setBottom(double b) { bottom = b; } double getAbove() { return above; }
2013-04-15 19:34:27 395
翻译 实验3
abstract class Employee { public abstract double earnings();}class YearWorker extends Employee { public double earnings() { System.out.println("1000"); return 0; }}class MonthWo
2013-04-15 19:27:10 480
翻译 try-catch的例子应用
class Ed2 { public static void main(String[]args) { int ch = 0; try { ch = System.in.read(); if(ch != 'q') { System.out.println((char)ch); } else { return; } }
2013-04-15 19:24:31 434
翻译 求图形面积
class Trangle { double sideA,sideB,sideC,length,area; boolean boo; public Trangle(double a,double b,double c) { this.sideA = a; this.sideB = b; this.sideC = c; if(a+b>c&&(a-b boo
2013-04-15 19:18:41 480
转载 简单的方法重载
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;
2013-03-29 21:42:53 400
转载 创建多个不同的对象
class Lader { double above,bottom,height; Lader(){} Lader(double a,double b,double h) { above = a ; bottom = b; height = h; } public void setAbove(double a) { above = a ; } p
2013-03-29 21:40:01 562
翻译 四位随机验证码,如何做到更简洁??
class Validator { public static void main(String[]args) { System.out.println(getRandom()); } public static int getRInt() { return (int)(Math.random()*10); } public static char getRChar
2013-03-29 21:35:48 519
翻译 猜随机数字的java代码,还能改进吗??
class Guessnumber { public static void main(String[]args) throws Exception { int guess = (int)(Math.random()*21); int ch = 0; int input = 0; int times = 0; boolean isEnd = false;
2013-03-29 21:27:54 465
原创 输入几个整数求积
import java.util.*;class Hwork { public static void main(String []args) { Scanner reader = new Scanner(System.in); int sum = 1; int m = 0; while(reader.hasNextInt()) { int x = read
2013-03-07 23:01:22 906
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人