九九热最新网址,777奇米四色米奇影院在线播放,国产精品18久久久久久久久久,中文有码视频,亚洲一区在线免费观看,国产91精品在线,婷婷丁香六月天

歡迎來(lái)到裝配圖網(wǎng)! | 幫助中心 裝配圖網(wǎng)zhuangpeitu.com!
裝配圖網(wǎng)
ImageVerifierCode 換一換
首頁(yè) 裝配圖網(wǎng) > 資源分類(lèi) > DOC文檔下載  

JAVA基礎(chǔ)面試題1

  • 資源ID:28991762       資源大小:76KB        全文頁(yè)數(shù):13頁(yè)
  • 資源格式: DOC        下載積分:15積分
快捷下載 游客一鍵下載
會(huì)員登錄下載
微信登錄下載
三方登錄下載: 微信開(kāi)放平臺(tái)登錄 支付寶登錄   QQ登錄   微博登錄  
二維碼
微信掃一掃登錄
下載資源需要15積分
郵箱/手機(jī):
溫馨提示:
用戶(hù)名和密碼都是您填寫(xiě)的郵箱或者手機(jī)號(hào),方便查詢(xún)和重復(fù)下載(系統(tǒng)自動(dòng)生成)
支付方式: 支付寶    微信支付   
驗(yàn)證碼:   換一換

 
賬號(hào):
密碼:
驗(yàn)證碼:   換一換
  忘記密碼?
    
友情提示
2、PDF文件下載后,可能會(huì)被瀏覽器默認(rèn)打開(kāi),此種情況可以點(diǎn)擊瀏覽器菜單,保存網(wǎng)頁(yè)到桌面,就可以正常下載了。
3、本站不支持迅雷下載,請(qǐng)使用電腦自帶的IE瀏覽器,或者360瀏覽器、谷歌瀏覽器下載即可。
4、本站資源下載后的文檔和圖紙-無(wú)水印,預(yù)覽文檔經(jīng)過(guò)壓縮,下載后原文更清晰。
5、試題試卷類(lèi)文檔,如果標(biāo)題沒(méi)有明確說(shuō)明有答案則都視為沒(méi)有答案,請(qǐng)知曉。

JAVA基礎(chǔ)面試題1

JAVA語(yǔ)言基礎(chǔ)筆試題-1Question 1 (43)Given:1. class TestA 2. public void start() System.out.println(”TestA”); 3. 4. public class TestB extends TestA 5. public void start() System.out.println(”TestB”); 6. public static void main(String args) 7. (TestA)new TestB().start(); / TestA x=new TestB(); x.start();8. 9. What is the result?A. TestAB. TestBC. Compilation fails.D. An exception is thrown at runtime.答案:B考點(diǎn):繼承環(huán)境下,父類(lèi)引用變量指向子類(lèi)的問(wèn)題。說(shuō)明:繼承環(huán)境下,父類(lèi)引用變量指向子類(lèi)對(duì)象時(shí)調(diào)用的方法應(yīng)從子類(lèi)先找,如果子類(lèi)沒(méi)有找到再?gòu)母割?lèi)中查找。Question 2Given:1. interface TestA String toString(); 2. public class Test 3. public static void main(String args) 4. System.out.println(new TestA() 5. public String toString() return “test”; 6. );7. 8. What is the result?A. testB. nullC. An exception is thrown at runtime.D. Compilation fails because of an error in line 1.E. Compilation fails because of an error in line 4.F. Compilation fails because of an error in line 5.答案:A考點(diǎn):接口的考察。說(shuō)明:本體在輸出語(yǔ)句中直接創(chuàng)建TestA的對(duì)象,并在語(yǔ)句中完成并且調(diào)用toString()方法。Question 3Given:11. public abstract class Shape 12. int x;13. int y;14. public abstract void draw();15. public void setAnchor(int x, int y) 16. this.x = x;17. this.y = y;18. 19. and a class Circle that extends and fully implements the Shape class.Which is correct?A. Shape s = new Shape();s.setAnchor(10,10);s.draw();B. Circle c = new Shape();c.setAnchor(10,10);c.draw();C. Shape s = new Circle();s.setAnchor(10,10);s.draw();D. Shape s = new Circle();s->setAnchor(10,10);s->draw();E. Circle c = new Circle();c.Shape.setAnchor(10,10);c.Shape.draw();答案:B考點(diǎn):考察子類(lèi)繼承和抽象類(lèi)的問(wèn)題。說(shuō)明:在繼承和抽象類(lèi)中,子類(lèi)對(duì)象不能調(diào)用父類(lèi)的方法,當(dāng)父類(lèi)引用變量指向之類(lèi)對(duì)行時(shí),指代的是父類(lèi)的部分,不能調(diào)用子類(lèi)的方法。抽象類(lèi)中未完成的放法不能被調(diào)用,只有完成了方法才能被調(diào)用。Question 4Given:10. abstract public class Employee 11. protected abstract double getSalesAmount();12. public double getCommision() 13. return getSalesAmount() * 0.15;14. 15. 16. class Sales extends Employee 17. / insert method here18. Which two methods, inserted independently at line 17, correctlycomplete the Sales class? (Choose two.)A. double getSalesAmount() return 1230.45; B. public double getSalesAmount() return 1230.45; C. private double getSalesAmount() return 1230.45; D. protected double getSalesAmount() return 1230.45; 答案:AB考點(diǎn):抽象類(lèi)被繼承時(shí),方法的可見(jiàn)度問(wèn)題。說(shuō)明:當(dāng)抽象類(lèi)被繼承時(shí),子類(lèi)必須重寫(xiě)父類(lèi)的抽象方法,且子類(lèi)的方法可見(jiàn)度必須比父類(lèi)的可見(jiàn)度更廣。Question 5Given:10. interface Data public void load(); 11. abstract class Info public abstract void load(); Which class correctly uses the Data interface and Info class?A. public class Employee extends Info implements Data public void load() /*do something*/ B. public class Employee implements Info extends Data public void load() /*do something*/ C. public class Employee extends Info implements Data public void load() /*do something */ public void Info.load() /*do something*/ D. public class Employee implements Info extends Data public void Data.load() /*d something */ public void load() /*do something */ E. public class Employee implements Info extends Data public void load() /*do something */ public void Info.load() /*do something*/ F. public class Employee extends Info implements Datapublic void Data.load() /*do something*/ public void Info.load() /*do something*/ 答案:A考點(diǎn):抽象類(lèi)和接口在繼承和繼承接口中的問(wèn)題。說(shuō)明:子類(lèi)可以同時(shí)繼承抽象類(lèi)和接口類(lèi),子類(lèi)的必須必須重寫(xiě)抽象類(lèi)和接口的方法。如果抽象類(lèi)和接口有相同的未完成的方法名,這子類(lèi)中只要寫(xiě)一個(gè)就可以。Question 6Given:11. public abstract class Shape 12. private int x;13. private int y;14. public abstract void draw();15. public void setAnchor(int x, int y) 16. this.x = x;17. this.y = y;18. 19. Which two classes use the Shape class correctly? (Choose two.)A. public class Circle implements Shape private int radius;B. public abstract class Circle extends Shape private int radius;C. public class Circle extends Shape private int radius;public void draw();D. public abstract class Circle implements Shape private int radius;public void draw();E. public class Circle extends Shape private int radius;public void draw() /* code here */F. public abstract class Circle implements Shape private int radius;public void draw() / code here */ 答案:E考點(diǎn):繼承環(huán)境下,抽象類(lèi)的抽象放法被繼承時(shí)的問(wèn)題.說(shuō)明:抽象類(lèi)被繼承時(shí)應(yīng)使用extends,且抽象類(lèi)中的抽象方法應(yīng)給在子類(lèi)中完成。Question 7Which two classes correctly implement both the java.lang.Runnableand the java.lang.Clonable interfaces? (Choose two.)A. public class Sessionimplements Runnable, Clonable public void run();public Object clone();B. public class Sessionextends Runnable, Clonable public void run() / do something */ public Object clone() / make a copy */ C. public class Sessionimplements Runnable, Clonable public void run() / do something */ public Object clone() /* make a copy */ D. public abstract class Sessionimplements Runnable, Clonable public void run() / do something */ public Object clone() /*make a copy */ E. public class Sessionimplements Runnable, implements Clonable public void run() / do something */ public Object clone() / make a copy */ 答案:CE考點(diǎn):考察接口被子類(lèi)繼承的規(guī)則。說(shuō)明:接口被繼承時(shí)應(yīng)在類(lèi)后面寫(xiě)上被繼承的接口,且要完成接口中所有未完成的方法。Question 8Click the Exhibit button.1. public class GoTest 2. public static void main(String args) 3. Sente a = new Sente(); a.go();4. Goban b = new Goban(); b.go();5. Stone c = new Stone(); c.go();6. 7. 8.9. class Sente implements Go 10. public void go() System.out.println(”go in Sente.”); 11. 12.13. class Goban extends Sente 14. public void go() System.out.println(”go in Goban”); 15. 16.17. class Stone extends Goban implements Go 18.19. interface Go public void go(); What is the result?A. go in Gobango in Sentego in SenteB. go in Sentego in Sentego in GobanC. go in Sentego in Gobango in GobanD. go in Gobango in Gobango in SenteE. Compilation fails because of an error in line 17.答案:C考點(diǎn):考察接口被實(shí)現(xiàn)和的問(wèn)題。說(shuō)明:本題考察接口被實(shí)現(xiàn)時(shí)應(yīng)重寫(xiě)接口中的方法,當(dāng)一個(gè)子類(lèi)同時(shí)繼承和實(shí)現(xiàn)接口時(shí),在兩父類(lèi)中都有的方法,在子類(lèi)中只需繼承非接口父類(lèi)的方法或重寫(xiě)父類(lèi)的方法。Question 9Given:11. public static void parse(String str) 12. try 13. float f= Float.parseFloat(str);14. catch (NumberFormatException nfe) 15. f= 0;16. finally 17. System.out.println(f);18. 19. 20. public static void main(String args) 21. parse(“invalid”);22. What is the result?A. 0.0B. Compilation fails.C. A ParseException is thrown by the parse method at runtime.D. A NumberFormatException is thrown by the parse method atruntime.答案:B考點(diǎn):考察異常和變量定義問(wèn)題。說(shuō)明:本題通過(guò)異常來(lái)考察變量定義的使用塊,在try塊中定義的f不能在catch塊中不能再使用f,否則將導(dǎo)致編譯錯(cuò)誤。Question 10Click the Exhibit button.1. public class Test 2. int x= 12;3. public void method(int x) 4. x+=x;5. System.out.println(x);6. 7. Given:34. Test t = new Test();35. t.method(5);What is the output from line 5 of the Test class?A. 5B. 10C. 12D. 17E. 24答案:C考點(diǎn):考察形參與實(shí)參的用法。說(shuō)明:本題method()方法被調(diào)用且把5賦值給形參后,在方法中只改變形參的值,不管形參如何改變,都不影響實(shí)參的值。Question 11Given:55. int x= 1, 2,3,4, 5; / new int1,2,3,4,556. int y =x;57. System.out.println(y2);Which is true?A. Line 57 will print the value 2.B. Line 57 will print the value 3.C. Compilation will fail because of an error in line 55.D. Compilation will fail because of an error in line 56.答案:B考點(diǎn):考察數(shù)組的用法。說(shuō)明:本題數(shù)組x把值賦給數(shù)組y,再通過(guò)數(shù)組下標(biāo)來(lái)找數(shù)值。Question 12Given:35. String #name = “Jane Doe”;36. int $age=24;37. Double _height = 123.5;38. double temp = 37.5;Which two are true? (Choose two.)A. Line 35 will not compile.B. Line 36 will not compile.C. Line 37 will not compile.D. Line 38 will not compile.答案:BC考點(diǎn):標(biāo)示符的用法。說(shuō)明:標(biāo)識(shí)符由大小寫(xiě)字母,下劃線(xiàn),數(shù)字,$符號(hào)組成,開(kāi)頭可以是大小寫(xiě)字母,下劃線(xiàn),和$符號(hào)。Question13Which two code fragments correctly create and initialize a static arrayof int elements? (Choose two.)A. static final int a = 100,200 ;B. static final int a;static a=new int2; a0=100; a1=200; C. static final int a = new int2 100,200 ;D. static final int a;static void init() a = new int3; a0=100; a1=200; 答案:AC考點(diǎn):考察數(shù)組的定義。說(shuō)明:一個(gè)數(shù)組可以直接初始化,系統(tǒng)會(huì)制動(dòng)幫你創(chuàng)建,也可以創(chuàng)建后在初始化。Question 14Given:11. public static void main(String args) 12. Object obj =new int 1,2,3 ;13. int someArray = (int)obj;14. for (int i: someArray) System.out.print(i +“ “)15. What is the result?A. 1 2 3B. Compilation fails because of an error in line 12.C. Compilation fails because of an error in line 13.D. Compilation fails because of an error in line 14.E. A ClassCastException is thrown at runtime.答案:A考點(diǎn):考察數(shù)組的用法。說(shuō)明:本題創(chuàng)建一個(gè)數(shù)組賦給它的引用變量為obj,在通過(guò)obj把數(shù)組的地址賦給array。Question 15Given:10. class Foo 11. static void alpha() /* more code here */ 12. void beta() /* more code here */ 13. Which two are true? (Choose two.)A. Foo.beta() is a valid invocation of beta().B. Foo.alpha() is a valid invocation of alpha().C. Method beta() can directly call method alpha().D. Method alpha() can directly call method beta().答案:Question 16A programmer needs to create a logging method that can accept anarbitrary number of arguments. For example, it may be called in theseways:logIt(”log message 1 “);logIt(”log message2”,”log message3”);logIt(”log message4”, “l(fā)og message5”, “l(fā)og message6“);Which declaration satisfies this requirement?A. public void logIt(String * msgs)B. public void logIt(String msgs)C. public void logIt(String. msgs)D. public void logIt(String msg1, String msg2, String msg3)Question 17A programmer is designing a class to encapsulate the informationabout an inventory item. A JavaBeans component is needed todo this. The Inventoryltem class has private instance variables to storethe item information:10. private int itemId;11. private String name;12. private String description;Which method signature follows the JavaBeans naming standards formodifying the itemld instance variable?A. itemID(int itemId)B. update(int itemId)C. setItemId(int itemId)D. mutateItemId(int itemId)E. updateItemID(int itemId)Question 18Click the Exhibit button.1. public class A 2.3. private int counter = 0;4.5. public static int getInstanceCount() 6. return counter;7. 8.9. public A() 10. counter+;11. 12.13. Given this code from Class B:25. A a1 =new A();26. A a2 =new A();27. A a3 =new A();28. System.out.printIn(A.getInstanceCount() );What is the result?A. Compilation of class A fails.B. Line 28 prints the value 3 to System.out.C. Line 28 prints the value 1 to System.out.D. A runtime error occurs when line 25 executes.E. Compilation fails because of an error on line 28.Question 19A JavaBeans component has the following field:11. private boolean enabled;Which two pairs of method declarations follow the JavaBeans standardfor accessing this field? (Choose two.)A. public void setEnabled( boolean enabled)public boolean getEnabled()B. public void setEnabled( boolean enabled)public void isEnabled()C. public void setEnabled( boolean enabled)public boolean isEnabled()D. public boolean setEnabled( boolean enabled)public boolean getEnabled()Question 2041. Given:10. class One 11. public One foo() return this; 12. 13. class Two extends One 14. public One foo() return this; 15. 16. class Three extends Two 17. / insert method here18. Which two methods, inserted individually, correctly complete the Threeclass? (Choose two.)A. public void foo() B. public int foo() return 3; C. public Two foo() return this; D. public One foo() return this; E. public Object foo() return this; Question 21Given:10. class One 11. void foo() 12. 13. class Two extends One 14. /insert method here15. Which three methods, inserted individually at line 14, will correctlycomplete class Two? (Choose three.)A. int foo() /* more code here */ B. void foo() /* more code here */ C. public void foo() /* more code here */ D. private void foo() /* more code here */ E. protected void foo() /* more code here */ Question 22Click the Exhibit button.1. public interface A 2. public void doSomething(String thing);3. 1. public class AImpl implements A 2. public void doSomething(String msg) 3. 1. public class B 2. public A doit() 3. / more code here4. 5.6. public String execute() 7. / more code here8. 9. 1. public class C extends B 2. public AImpl doit() 3. / more code here4. 5.6. public Object execute() 7. / more code here8. 9. Which statement is true about the classes and interfaces in theexhibit?A. Compilation will succeed for all classes and interfaces.B. Compilation of class C will fail because of an error in line 2.C. Compilation of class C will fail because of an error in line 6.D. Compilation of class AImpl will fail because of an error in line 2.

注意事項(xiàng)

本文(JAVA基礎(chǔ)面試題1)為本站會(huì)員(仙***)主動(dòng)上傳,裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)上載內(nèi)容本身不做任何修改或編輯。 若此文所含內(nèi)容侵犯了您的版權(quán)或隱私,請(qǐng)立即通知裝配圖網(wǎng)(點(diǎn)擊聯(lián)系客服),我們立即給予刪除!

溫馨提示:如果因?yàn)榫W(wǎng)速或其他原因下載失敗請(qǐng)重新下載,重復(fù)下載不扣分。




關(guān)于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權(quán)所有   聯(lián)系電話(huà):18123376007

備案號(hào):ICP2024067431號(hào)-1 川公網(wǎng)安備51140202000466號(hào)


本站為文檔C2C交易模式,即用戶(hù)上傳的文檔直接被用戶(hù)下載,本站只是中間服務(wù)平臺(tái),本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權(quán)或隱私,請(qǐng)立即通知裝配圖網(wǎng),我們立即給予刪除!