我也下几个吧 一个不写太不好意思了 呵呵 超菜哈 28 接口可以继承接口的 所以 选 c or d 27 a 26 b 25 a 我实在 是写不下去了 看的我不行了,楼主 你也太很心了 水也不给我喝点, 24 a 你把这点东西 打出来 我看 也难为你了 23 c up up up ....... 22 b 21 b 20 b 19 a 18 d 17 a
兄弟这种学习态度不行呀!得好好学习呀! 上面的几个白痴,都那么错的答案还好意思往上写!我参考的《java 2 参考大全第四版》 18 d 19 a 20 a 21 a 22 b 23 c 24 d 25 c 26 d 27 a 28 d
11 c 12 c 13 d 14 d 15 a 16 c 17 a 我基本上可以保证我的答案是对得!就是13题有点疑问!13.一个抽象类中能否既定义抽象方法又定义非抽象方法? a.不是的,只能含有其中一种。 b.不是的,只能含有抽象方法。 c.是的,但子类不能继承抽象方法。 d.是的,子类可以继承上述两种方法。我得答案是D(当然只能是C或D两种)我得疑问是在(非抽象)子类中得必须重载实现抽象父类中的抽象方法!(这应该也叫继承吧?,这儿有点疑问) 别的问题明天再看!哈哈!
看看我做的二、1题abstract class Shape{ String shapename; int eara; int volume; void Shape(){} public void print(String name){} public int area(int width,int hight){return eara;} public int volume(int hight){return volume;} }class TwoDimensionalShape extends Shape{ String shapename; int area; int volume; void Shape(){} public void print(String name){ shapename=name; System.out.println("This is"+shapename+",it's TwoDimensionalShape" ); }
public int area(int width,int hight){ area=width*hight; return area; }
public int volume(int hight){return volume;} } class ThreeDimensionalShape extends Shape{ String shapename; int area; int volume; public void print(String name){ shapename=name; System.out.println("This is"+shapename+",it's TwoDimensionalShape" ); } public int area(int width,int hight){ area=width*hight; return area; } public int volume(int hight){ volume=area*hight; return volume; } }class ShapeTest{//这是对上面的测试,我在我的机子通过了。 public static void main(String[] args){ Shape one=new TwoDimensionalShape(); one.print("xxxshape"); System.out.println(one.area(44,3));
2、a
3、b
4、c
5、b
6、d
7、d
8、b
9、c
10、d
一:1a 2a 3b 4c 5d 6d 7a 8b 9c 10d 11c 12c 13d 14c 15a 16c 17a 18d 19a 20a 21a 22b 23c 24b 25a 26b 27a 28a二:
1 就是要你明白多态性,根据不同的子类可以打印出不同的形状面积 ! 2 用到Java.awt.*;或者Javax.swing.*;三:
1 用到File类,FileInputStream类,FileOutputStream类,即输入输出流,如果是双字节的还要用reader和writer的所属类. 2 线程方法 start()调用run()方法的主体,直到调用sleep()方法或者线程结束.以前的Java有suspend(),resume(),stop()方法,但这是造成死锁的祸根之一,后期版本就不支持了!
有三个状态:等待状态,运行状态,睡眠状态.
错误地方请指正!! :)
28 接口可以继承接口的 所以 选 c or d
27 a
26 b
25 a 我实在 是写不下去了 看的我不行了,楼主 你也太很心了 水也不给我喝点,
24 a 你把这点东西 打出来 我看 也难为你了
23 c up up up .......
22 b
21 b
20 b
19 a
18 d
17 a
有没有高手把第二题的详细答案给一下,感激不尽。
这是JAVA的期末考试题,我没有答案的。开卷。
上面的几个白痴,都那么错的答案还好意思往上写!我参考的《java 2 参考大全第四版》
18 d 19 a
20 a
21 a 22 b
23 c 24 d 25 c 26 d
27 a 28 d
12 c
13 d
14 d
15 a
16 c
17 a
我基本上可以保证我的答案是对得!就是13题有点疑问!13.一个抽象类中能否既定义抽象方法又定义非抽象方法?
a.不是的,只能含有其中一种。
b.不是的,只能含有抽象方法。
c.是的,但子类不能继承抽象方法。
d.是的,子类可以继承上述两种方法。我得答案是D(当然只能是C或D两种)我得疑问是在(非抽象)子类中得必须重载实现抽象父类中的抽象方法!(这应该也叫继承吧?,这儿有点疑问)
别的问题明天再看!哈哈!
15d 16c 17 a 18d 19a 20a 21a 22b 23c 24d 25c 26b 27a 28c
今天偶也考试了
String shapename;
int eara;
int volume;
void Shape(){}
public void print(String name){}
public int area(int width,int hight){return eara;}
public int volume(int hight){return volume;}
}class TwoDimensionalShape extends Shape{
String shapename;
int area;
int volume;
void Shape(){}
public void print(String name){
shapename=name;
System.out.println("This is"+shapename+",it's TwoDimensionalShape" );
}
public int area(int width,int hight){
area=width*hight;
return area;
}
public int volume(int hight){return volume;}
}
class ThreeDimensionalShape extends Shape{
String shapename;
int area;
int volume;
public void print(String name){
shapename=name;
System.out.println("This is"+shapename+",it's TwoDimensionalShape" );
} public int area(int width,int hight){
area=width*hight;
return area;
} public int volume(int hight){
volume=area*hight;
return volume;
}
}class ShapeTest{//这是对上面的测试,我在我的机子通过了。
public static void main(String[] args){
Shape one=new TwoDimensionalShape();
one.print("xxxshape");
System.out.println(one.area(44,3));
Shape two=new ThreeDimensionalShape();
two.print("xxxxshape");
System.out.println(two.area(5,6));
System.out.println(two.volume(7));
}
}
不好意思我没加注释,没时间了。
3.2没时间看估计书中应该会有这方面的资料,自己看看吧!
我也没加注解,代码很短,很好理解!import java.io.*;
public class try31
{
public static void main(String[] args)
{
try
{ File newFile=new File("d:/tryaccess.txt");
RandomAccessFile myFile=new RandomAccessFile(newFile,"rw");
myFile.seek(myFile.length());
myFile.writeInt(13);
}
catch(IOException e)
{
System.err.println(e);
}
}
}
以上代码经过测试,运行正常!!
做做选择题,我自己做的哦,别不信,满有意思的。
1a 2a 3b 4c 5d 6d 7a 8b 9c 10a 11c 12c 13d 4d 15a 16c 17a 18d 19a 20a 21a 22b 23c 24d 25c 26d 27d 28d
23c 14d 15c 16b 17a 18d
3 b
4 c
5 b
6 d
7 a
8 b
9 c
10 a
11 c
12 d
13 c
14 c
15 a
16 b
17
18 d
19 a
20 b
21 a
22 b
23 c
24 d
25 b
喝酒后写的,不要见外,也许有很多问题的!!