mwbr.net
当前位置:首页 >> jAvA编程,一道作业题 >>

jAvA编程,一道作业题

程序及测试结果如下:自己看结果总结一下。可以自己运行,最后设置为1000.更为明显(设置为1000,运行结果太长贴不上) public class MyThread extends Thread { private int i; public void setI(int i){ this.i=i; } public void run(){ for(i...

package my.test.main;import java.util.Scanner;public class Exam {/** * @param args */public static void main(String[] args) {// TODO Auto-generated method stubScanner in = new Scanner(System.in);int score = 0;// 十次循环,出题f...

public interface computable { String MAX=""; public int f(int x); } class China implements computable{ public int f(int x){ return x; } } class Japan implements computable{ public int f(int x){ return x; } } class Dome{ int y; ...

public static String[][] readTxtFile(String filePath){String[][] all = new String[1000][10]; try { String encoding="GBK"; File file=new File(filePath); if(file.isFile() && file.exists()){ //判断文件是否存在 InputStreamReader re...

1.接口 public interface IShape { public double area( ); } 2.实现类 public class square implements IShape { private int length; public square(int length) { this.length = length; } public double area() { // TODO Auto-generated me...

public class MyDate {private int year ;private int month ;private int day ;public MyDate(){}public MyDate(int year, int month, int day) {super();this.year = year;this.month = month;this.day = day;}public String toString() {retu...

package jisuanqi; import java.awt.BorderLayout; import java.awt.Dimension; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JButton; import javax.swing.BorderFactory; import java.awt.Rectangle; import ja...

// 正好无聊,给你写一个,不过这种作业还是建议自己做 import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.a...

//这次算对了,可以运行。 package math; public class Sin { public static int factorial(int n){ int res = 1; for(int i = 2; i < n+1; i++){ res *= i; } return res; } public static double sin(double x){ if(x > 3.1416 || x < -3.1416...

public class Shuzu {public static void main(String[] args) {getMax();getSum();}public static void getMax(){int[] buf={10,15,12,9,7};int max=0;for (int i = 0; i < buf.length; i++) {if(buf[i]>max){max=buf[i];}}System.out.println(...

网站首页 | 网站地图
All rights reserved Powered by www.mwbr.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com