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

JAVA 编程题

/** * 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 =...

//圆类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...

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(" "); } //下面的两个循环是为了打...

public static void GetSum() { int sum = 0; for(int i=1;i

两个代码 一个学生类, 一个测试类 你自己把他们放不同包里面 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...

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

运行结果: 代码如下: class TV {private int channel;private int volumeLevel;private boolean on;public TV() {this.channel = 1;this.volumeLevel = 1;this.on = false;}public void turnOn() {this.on = true;}public void turnOff() {thi...

import java.util.Arrays;import java.util.Scanner;public class TestExample {public static void main(String[] args) {Scanner scanner = new Scanner(System.in);int n = Integer.parseInt(scanner.nextLine());int[][] index = new int[n]...

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