tnfh.net
当前位置:首页 >> jAvA语言编程题,题目如下 >>

jAvA语言编程题,题目如下

package test;public class Father {private String name;class Child{public void introFather(){System.out.println(name);}}public Child newChild(){return new Child();}public String getName() {return name;}public void setName(String...

按照你的要求打印1000以内完数的Java程序如下: public class WanQuanShu { public static void main(String[] args) { int i,j,k; //定义整型变量i,j,k 用于for循环 int []sector=new int[32]; //定义整型数组用于存放完全数的每个因子 for(i=1;i

int i=0; //保存百位上的数int j=0; //保存十位上的数int k=0; //保存各位上的数int t=0; //保存数字个数 for(i=1;i

import java.io.File; public class Folder { /** * @param args */ public static void main(String[] args) { if (args.length == 0) {// 显示当前目录下的树状内容 showAllContent("./", ""); return; } if (args.length == 1) {// 显示指定...

public class Demo1 {public static void main(String[] args) throws Exception {System.out.println(" J A V V A");System.out.println(" J A A V V A A");System.out.println("J J AAAAA V V AAAAA");System.out.println(" J J A A V A A");}...

/*求出生兔子数的函数,其中参数month为当前月份*/ rBirth(month) { if(month==0) return 1; else if(month==1) return 1; else return rBirth(month-1)+rBirth(month-2); } main() { printf("\n%d",rBirth(n));/*输出结果*/ getch(); } 这题很...

给你写好了。如下: public class Circle {private double radius;public final static double PI = 3.14;public Circle(double radius) {this.radius = radius;}public double getArea() {return PI * radius * radius;}public static void mai...

public static void main(String[] args) { // 路径可以换,这里是绝对路径 File src = new File("d:/source.txt"); File aim = new File("d:/aim.txt"); try { // 文件不存在则新建 if (!aim.exists()) { aim.createNewFile(); } } catch (IOExc...

public class Main {public static void main(String[] args) throws Exception {Circle c1 = new Circle();c1.setRadius(5);Circle c2 = new Circle(8);int compareResult = compareCircle(c1, c2);if (compareResult > 0) {System.out.println...

import javax.swing.JFrame; import java.awt.Button; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class testButton extends JFrame { public static void main(String[] args) { new testButton("testB...

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