l**b 发帖数: 457 | 1 Exception本身就是implements了Throwable了的,你extends和implements达到的效果
都是一样的。
我试了你的code,没有你说的问题啊?
Shape.java:
public class Shape {
public static final double DEFAULT_SIZE = 1.0;
private String name;
public Shape(String name) {
this.name = name;
}
}
Rectangle.java:
public class Rectangle extends Shape {
public static final String RECTANGLE_NAME = "Rectangle";
private double length;
private double width;
public Rectangle ()
{
this(S... 阅读全帖 |
|
x****a 发帖数: 1229 | 2 作业,创建rectangle class, 要求 throw exceptions, 我的code如下:
public class rectangle extends Shape{
public Rectangle ()
{
this(Shape.DEFAULT_SIZE, Shape.DEFAULT_SIZE);
}
public Rectangle (double newLength, double newWidth)
{
this(Rectangle.RECTANGLE_NAME, newLength, newWidth);
}
protected Rectangle (String newName, double newLength, double newWidth)
{
super (newName);
try
{
this.setLength (newLength);
... 阅读全帖 |
|
T*****e 发帖数: 361 | 3 Not directly related to Java, though.
However, it makes it easier to read posts in this Java board :)
// ==UserScript==
// @name mitbbs.com
// @namespace http://mywebsite.com/myscripts
// @include http://www.mitbbs.com/*
// ==/UserScript==
function removeNode(nodeId) {
var node = document.getElementById(nodeId);
if (node) node.parentNode.removeChild(node);
}
function widthNode(nodeId, newWidth) {
var node = document.getElementById(nodeId);
if (node) node.st |
|