tnfh.net
当前位置:首页 >> JAVA 编程题 >>

JAVA 编程题

//圆类Circle import java.util.Scanner; public class Circle { private double radius; public double getRadius() { return radius; } public void setRadius(double radius) { this.radius = radius; } //无参构造函数 public Circle(){ thi...

/** * 2015年8月31日上午11:30:07 * @author cs12110 */public class WuMingFen {String theFen;// 粉的口味int quantity;// 重量boolean likeSoup;// 带汤标识public WuMingFen(String theFen, int quantity, boolean likeSoup) {this.theFen =...

两个代码 一个学生类, 一个测试类 你自己把他们放不同包里面 public class Student {private int Snum;private int Gnum;private String Sname;private String Ssex;private int Sage;private static int count = 0;public Student(int snum, i...

public static double multiple(double a, double b){return a*b;} public static double dvd(double a, double b){return a/b;} public static double op(double a){return a*-1;} public static double daoshu(double a){return 1/a;} public ...

1、Queue import java.util.LinkedList; public class Queue { LinkedList queue; public Queue() { queue = new LinkedList(); } void add(Object o) { queue.addLast(o); } Object get() { Object o = null; if (!queue.isEmpty()) { o = queu...

import java.util.ArrayList;import java.util.List;import java.util.Random;public class Rand {public static void main(String[] args) {List li = new ArrayList();for(int i=0;i

class Dog{ private String name; private String color; private int age; public Dog(String name,String color,int age){ this.name=name; this.color=color; this.age=age; } public void show(){ System.out.println("狗的名字:"+name); S...

Rectangle类: /** * 定义一个矩形类Rectangle,包含有长length,宽width属性、构造方法(要求写出初始化长和宽)和计算面积方法getArea()。 * 编写一个长方体Cuboid * ,继承自矩形类,具有长length、宽width、高height属性,构造方法和计算体...

public class Lingxing { public static void main(String[] args) { int i =0; int j =0; int m=0; System.out.println("打印的图形如下:"); //第一个循环控制打印的行数 for(i=1;ii;m--){ System.out.print(" "); } //下面的两个循环是为了打...

import java.util.*;import java.io.*;class Main{ public static void main(String[] args) throws Exception{ String[] ts={"A.txt","B.txt","C.txt"}; Scanner[] ss=new Scanner[ts.length]; for(int i=0;i

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