题目内容

GivenafileGrizzlyBear.java:
1.packageanimals.mammals;
2.
3.publicclassGrizzlyBearextendsBear{
4.voidhunt(){
5.Salmons=findSalmon();
6.s.consume();
7.}
8.}
andanotherfile,Salmon.java:
1.packageanimals.fish;
2.
3.publicclassSalmonextendsFish{
4.voidconsume(){/*dostuff*/}
5.}
Assumebothclassesaredefinedinthecorrectdirectoriesfortheftpackages,andthattheMammalclasscorrectlydefinesthefindSalmon()method.Whichtwochangesallowthiscodetocompilecorrectly?()

查看答案
更多问题

天然气的主要成分是CO。

1.publicclassA{
2.publicvoidmethod1(){
3.Bb=newB();
4.b.method2();
5.//morecodehere
6.}
7.}
1.publicclassB{
2.publicvoidmethod2(){
3.Cc=newC();
4.c.method3();
5.//morecodehere
6.}
7.}
1.publicclassC{
2.publicvoidmethod3(){
3.//morecodehere
4.}
5.}
Given:
25.try{
26.Aa=newA();
27.a.method1();
28.}catch(Exceptione){
29.System.out.print(”anerroroccurred”);
30.}
WhichtwoaretrueifaNullPointerExceptionisthrownonline3ofclassC?()

AssumingthattheserializeBanana()andthedeserializeBanana()methodswillcorrectlyuseJavaserializationandgiven:
importjava.io.*;
classFoodimplemerttsSerializable{intgood=3;}
classFruitexterndsFood{intjuice=5;}
publicclassBananaextendsFruit{
intyellow=4;
publicstaticvoidmain(String[]args){
Bananab=newBanana();Bananab2=newBanana();
b.serializeBanana(b);//assumecorrectserialization
b2=b.deserializeBanana();//assumecorrect
System.out.println(”restore+b2.yellow+b2.juice+b2.good);
}
//moreBananamethodsgohere
}
Whatistheresult?()

系统的温度越高,向外传递的热量越多。

答案查题题库