- 博客(13)
- 收藏
- 关注
原创 封装,简单继承
class English{ public static void printEnglish() { System.out.println("英文字母表:"); for (char ch='a';ch { System.out.print(ch+" "); } System.out.println(); }}class G
2012-11-09 20:56:47 461
原创 测试类,梯形,圆,三角形
class Triangle{ float a,b,c; Triangle(float a,float b,float c ) { this.a=a; this.b=b; this.c=c; } public void 修改边长(float x,float y,float z) { a=x; b=y; c=z;
2012-11-04 19:00:12 502
原创 初始化一个三角形
class Triangle{ float a,b,c; Triangle(float a,float b,float c ) { this.a=a; this.b=b; this.c=c; } public void 修改边长(float x,float y,float z) { a=x; b=y; c=z; }
2012-11-02 21:18:00 578
原创 将二维数组中值最大的元素和左上角元素对调,然后将值最小的元素与右下角元素对调。
public class TestNewMatrix { public static void main(String[] args) { // TODO Auto-generated method stub int[][] a={{1,4,5,6},{7,2,10,11},{8,9,12,3}}; System.out.pr
2012-11-02 20:16:06 2285
原创 1000以内的完数
public class TestComNum { public static void main(String[] args) { printComNum(1000); } public static void printComNum (int x) { for (int
2012-11-02 19:42:07 446
原创 随便输一个数,从大到小排序
import java.util.Scanner;class paixu { public static void main(String[] args) { System.out.println("请输入一个数:"); Scanner scan=new Scanner(System.in); int x=scan.nextInt(); so
2012-11-02 19:40:21 505
原创 数组相乘
public class arraycheng{ public static void main(String[] args) { int[][] MatrixA={{1,5,7,3}, {3,6,3,9}, {1,2,8,7}, {0,3,1,9},
2012-09-27 20:09:49 885
原创 数组相加
class juzhenjia{ public static void main(String args[]) { int[][] a={{1,1,1,1},{1,2,2,1},{1,2,2,1},{1,1,1,1}};//初始化数组如4*4 int[][] b={{2,2,3,3},{3,3,4,4},{5,5,6,6},{4,4,6,6}
2012-09-27 20:08:52 509
原创 除对角线以外的求和
public class TestMatrix { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub int[][] a={{1,1,1,1},{1,2,2,1
2012-09-21 17:23:19 546
原创 千以内的素数
class qiansusuo{ public static void main(String[] args) { System.out.print("2 3 "); int n=2; for (int j=2;j { for (int i=2;i { if (j%i==2) { brea
2012-09-21 16:49:54 503
原创 判断一个数是否为素数
import java.util.Scanner; class susuo{ public static void main(String[] args) { System.out.println("请输入一个数"); Scanner in=new Scanner(System.in); int s=in.nextInt(); if (s==
2012-09-21 16:49:12 701
原创 猜数字游戏。编写一个Java应用程序,实现功能:
import javax.swing.JOptionPane; public class GuessNumber { public static void main (String args[ ]) { guess(); } static void guess(){
2012-09-14 23:58:57 8182
原创 2. 编写一个Java应用程序,用户从键盘输入一个1~9999之间的数,程序将判断这个数是几位数,并判断这个数是否是回文数。回文数是指将该数含有的数字逆序排列后得到的数和原数相同,例如12121、32
import javax.swing.JOptionPane; public class TestNumber { public static void main(String args[]) { loopNumber(); } static void loopNumber(){
2012-09-14 23:57:40 13085 2
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人