第一篇:java英語面試試題整理
1.What are java beans?
JavaBeans is a portable, platform-independent component model written in the Java programming language, developed in collaboration with industry leaders.It enables developers to write reusable components once and run them anywhere--benefiting from the platform-independent power of Java technology.JavaBeans acts as a Bridge between proprietary component models and provides a seamless and powerful means for developers to build components that run in ActiveX container applications.Java beans is very powerful tool you can use in your servlet/JSP bridge.You can use the servlets to build the bean and can be passed over to the JSP for reading.This provides tight encapsulation of the data while preserving the sanctity of servlets and JSP。2.What is RMI?
RMI stands for Remote Method Invocation.Traditional approaches to executing code on other machines across a network have been confusing as well as tedious and error-prone to implement.The nicest way to think about this problem is that some object happens to live on another machine, and that you can send a message to the remote object and get a result as if the object lived on your local machine.This simplification is exactly what Java Remote Method Invocation(RMI)allows you to do.3.How does Java inheritance work?
A class can only directly extend one class at a time.Multiple inheritance is only allowed with regard to interfaces.A class can implement many interfaces.But a class can only extend one non-interface class.4.How does exception handling work in Java?
1.It separates the working/functional code from the error-handling code by way of try-catch clauses.2.It allows a clean path for error propagation.If the called method encounters a situation it can't manage, it can throw an
exception and let the calling method deal with it.3.By enlisting the compiler to ensure that “exceptional” situations are anticipated and accounted for, it enforces powerful coding.4.Exceptions are of two types: Compiler-enforced exceptions, or checked exceptions and Runtime exceptions, or unchecked exceptions.Compiler-enforced(checked)exceptions are instances of the Exception class or one of its subclasses--excluding the RuntimeException branch.The compiler
expects all checked exceptions to be appropriately handled.Checked exceptions must be declared in the throws clause of the method throwing them--assuming, of course, they're not being caught within that same method.The calling method must take care of these exceptions by either catching or declaring them in its throws clause.Thus, making an exception checked forces us to pay heed to the possibility of it
being thrown.An example of a checked exception is java.io.IOException.As the name suggests, it throws whenever an input/output operation is abnormally terminated.5.Does Java have destructors?
Java does not have destructors.Garbage collector does this job periodically depending upon the memory requirements of the machine and on the fact that a particular object is no longer needed.But it has finalizers that does a similar job.The syntax is
public void finalize(){ }
If an object has a finalizer, the method is invoked before the system garbage collects the object, but using finalize()does not guarantee that it would be called b4 garbage collector is invoked.6.What does the “final” keyword mean in front of a variable? A method? A class?
A final variable cannot be reassigned, but it is not constant.For instance, final StringBuffer x = new StringBuffer();
x.append(“hello”);
is valid.X cannot have a new value in it, but nothing stops operations on the object that it refers, including destructive operations.Also, a final method cannot be overridden or hidden by new access specifications.This means that the compiler can choose to in-line the invocation of such a method.(I don't know if any compiler actually does this, but it's true in theory.)
The best example of a final class is String, which defines a class that cannot be derived.6.Access specifiers: “public”, “protected”, “private”, nothing?
Public?Any other class from any package can instantiate and execute the classes and methods Protected? Only subclasses and classes inside of the package can access the classes and methods Private? The original class is the only class allowed to execute the methods.And in case if there is no modifier specified, it means, only the classes inside the package can access this class and its methods, it is also called “Friendly”.Question:What is the difference between an Interface and an Abstract class?Question: What is the purpose of garbage collection in Java, and when is it used?
Question:Describe synchronization in respect to multithreading.1.what is single inheritance.ans:one class is inherited by only other one class
9.what is interface.ans:Interface has only method declarations but no definition
10.what is differenec between abstract class and interface.ans:In abstract class some methods may contain definition,but in interface every method should be abstract
11.how to u prove that abstrace class cannot instantiate directly.ans:As they dont have constructor they cant be instantiated
12.what is differenece between string and stringbuffer.ans:Strings are immutable where as string buffer can be modified
13.what is immutable
ans:Which cant be changed
18.what is legacy interface.ans: legacy is something that is old in terms of technology/ system
19.what is main difference hashmap and hastable
ans:Hash table is synchronized
20.what is main difference between arraylist and vector.ans:Vector is synchronised
22.what are distributed techonologies.distributed technologies means any technology / s/w program that are having many components in
multiple environments that interact with each other depending on the functional requirements and design.23.what is advantage and disadvantage of distributed techonologies.language is avoided.Application can be built flexible to meet requirements.Division of labour is
possible.Best of all the technologies and platforms can be optimally utilized.Complexity of requirements can be reduced.25.what is difference between procedure and functions.''
ans:Fuctions can return value ,procedures cant return value
26.what is jdbc.ans:Connecting to DB from java program requires JDBC
31.what is deployment descriptor.ans:Which contains the infrnmation like which file to be used
40.what is platfrom independent
ans:A language is said to be platform independent if it can be run on any machine with out modifying code
46.what is major concepts in oops.ans:Abstraction,polymorphism,encapsulation,inheritance
48.what is implicit object.ans:Implicit objects are a set of Java objects that the JSP Container makes available to developers in each page
49.how many implicit objects in jsp
ans:out,page,session,request,response,application,page context,config
介紹下自己情況
技術問題.基本在論壇上面資料都cover了.比如 list和array 區別, pass by reference or value, memory leakage, oo基本問題, overload/override, 數據庫clustered or non-clustered.還有quick sort和 binary sort介紹.復雜度.適用在哪里.有什么問題等等.基本準備下應該沒有問題,都很基本.這個過了就進入最后一輪 AC, 是5.5個小時的.從早上8:30開始.相比以前和其他公司.今年這個長度我覺得不累.哈哈.往年有1天半的AC.暈
面試基本是.group discussion+2個technical interviews+1個interpersonal skill interview.全部2個對你一個.group discussion 是給了幾個os+database+gui資料, 然后要求選擇哪個合適.四個人一組.然后2個人資料是來自相同department的email.根據自己和其他人的資料.選系統.我可以說的就是.要get involved, 如果有不了解問題.不要怕要問其他人來確認..做完后.hr會殺入在給一個資料.然后繼續做討論15分鐘.反正就是多說就是了.多和其他人交流.然后就是一般面試...介紹自己, 為什么要做這個,為什么學這個學校, teamwork, 對公司了解, 有個特別點問題就是.如果你是boss在開10人大會.下面你的員工說的東西有個很大的錯誤,而且很基本的錯誤.你怎么辦.還有如果回到幾年前.你會有什么選擇會改變嗎.(我就說不讀phd了,申請ms直接.哈哈)這個部分問題很多.準備要充分.而且很多問題是根據你自己回答.他們追下去問.后面就是兩個technical interview, 我大概回憶下.有np/p問題, hashmap, hash原理, deadlock問題, java GC 問題, 還有很多多線程問題(具體有點忘記了), 記得一個GC在多線程環境下的操作.還有j2ee問題.介紹下spring, soap, hibernate.(基本就可以了).c 內存操作問題, 還有 internet, ip和tcp區別.然后osi說幾個protocols.第二個面試.基本都是數據結構.寫個 binary search tree 來找某個值, 要遞歸和非遞歸的.然后hash table, 還有點不記得了.然后數據庫.寫個簡單的er 圖.學生, 課程.然后寫sql.還要早最大值.然后排序的sql.基本的很.然后說下dns是什么.怎么實現的.最后說下從你在瀏覽器輸入一個網址.到內容被全部顯示的過程, 原理等等.基本面試完了.然后去吃飯和以前的graduate scheme的人聊聊.
第二篇:JAVA面試
馬老師:
您好,昨天下午面試的中軟資源。因為筆試時間很短(她之前并沒說多長時間,我估計就只有30多分鐘就要收卷),而且題量很大,所以沒有記下題目,不過前面的題目都很簡單,主要是咱們做的那些基礎題。后面的主觀題是:
1、詳細敘述5種以上種的設計模式
2、詳細說明類的設計原則
3、sql語句的調優
還有一個忘記了!
完了之后人事的會做初步面試,首先自我介紹,然后問離職原因,以前的一些工作情況。再就是簡單介紹他們目前要做的項目情況,會說工作很幸苦之類的話,最后會問薪水要求!
再就是技術人員面,感覺他們對基礎知識很看重,當然首先是自我介紹。會問到一些詳細的知識點,比如說怎么配置DWR,sql語句的調優,當然項目也是得問的,主要介紹最近的項目,做過什么東西!
最后是技術總監,開始也是自我介紹。技術方面問的少,就問我jbpm和我做過什么以及用到的一些開源框架和工具。然后問3到5年的職業規劃,再給我一份英文的文檔讓我翻譯(他不會告訴你是關于什么方面,我傻到居然去問他)。后面有人遇到這種情況要先看文檔大標題,完了告訴他這文檔大概是關于什么的(給我的是分需求文檔),不要一上來就往細里看,那位總監就批評過我,完了再看細節。最后問我有什么問題!
如果問到的一些知識沒聽過,就說這些不會是以后項目開發中的問題,因為我們以前也是好多技術都是在項目中邊學習邊開發的,不可能我們什么技術都會了都準備好了再去做開發。面試中也問道過倆,我不知道是什么,按照上面的回答,感覺對方還是比較滿意,也沒有為難我!
這些都跟面得職位有關,職位不同情況可能不同。我面得是中軟內部的職位,不是外包。
中科軟筆試
1.集合類
2.servlet生命周期
3.string,stringbuffer,區別,int integer 區別
4.常見的運行時異常
5.寫出幾個常見的類,包,接口
6.寫一個單例
7.抽象類和接口的區別
8.還有兩頁的SQL選擇題,我不太記得了
9.怎么配置tomcat的內存大小
10.數據庫連接池的原理
11.觸發器有哪幾種,并說說每一種
12.還有JSP中靜態include和動態include區別
13.jsp的9種內置對象
14.選擇題好幾個都是關于主鍵的,記不清了
還有一個是寫幾種常用的數據結構,并寫出實現原理
還有一個也是數據 結構上的,我不記得了,我連見都沒見過 還有一個是程序改錯題,挺簡單的
第三篇:面試筆試題總結(java)
筆試題部分:
1、(北京37期)編程題:編寫一段程序用于生成隨機碼,入參為隨機碼長度,出參為隨機碼,要求隨機碼中必須包含大小寫字母及數字
,2015/5/5 15:59:38
2、(北京37期)編寫一段程序用于判斷一個字符串是否是合法的IP地址
3、筆試題最難的內容:
根據給定的表,寫一個存儲過程:
客戶信息表(客戶編號、客戶名稱,聯系方式...)
訂單表(訂單號,訂單名稱,訂單價格合計,訂單明細信息id,客戶編號)訂單明細表(id,產品名稱,單位,單價,數量)該存儲過程要求根據客戶編號,查詢該客戶的訂單以及該訂單下不同產品價格合計;
即: 客戶編號、客戶 名稱、訂單號、訂單名稱、產品id、數量合計、價格合計
4、筆試題最惡心的:英文閱讀翻譯等;腦筋急轉彎;
5、沒涉及到的筆試題(自己百度或者求助同學)
6、其他筆試題(老師將上一期學生筆試題內容以圖片形式保存了,到時候按時下載)
7、不用循環寫一個小于5000以2的倍數遞增并輸出值?
上機題:
上機題可能有如下幾個考點:
1、手動搭建SSH框架,寫一套增刪改查
2、解析一個XML文件(sax、DOM解析)
3、寫一個方法,實現掃描指定路徑下某個文件夾中所有文件(獲取文件個數,文件名稱等);
4、使用SSH框架,結合給定頁面,實現功能(一般涉及到ajax)
面試題部分:
1、談談你對java的了解?
Java是面向對象的、具有安全性、可移植性、跨平臺性、并發性。Java有三個平臺J2EE、J2ME、J2SE
2、面向對象的三個特性:
繼承封裝多態(體現在哪里?)
繼承:子類繼承父類,子類能夠繼承父類中非私有的方法或者變量,繼承的好處是可以使程序大量的復用;缺點是如果過多繼承會導致程序結構龐大
封裝:體現在包、訪問修飾符以及setget方法取值,還有某些操作封裝到方法中
多態:實例化對象,一個類可以new多次,構造方法的重載重寫也體現多態;
3、面向對象的過程
面向對象分析、面向對象設計、面向對象編程
4、java的八個基本數據類型 和對應的包裝類和每一種類型的長度
Byte、short、int、long、double、float、char、boolean
5、異常和錯誤區別? 運行時異常和非運行時異常(編譯時異常)區別,說出幾個你用過的異常?如何捕獲異常?Throws和throw區別?
異常: 程序運行過程中產生的某些錯誤,程序人員通過修改程序可以修復的,程序員可以預知的錯誤;
錯誤: 表示系統級別的錯誤,例如系統崩潰,jvm內存溢出等;無法預知并且修改程序也無法避免的;
運行時異常:表示程序運行過程中產生的異常,可以不強制try catch捕獲或者不強制的throws,程序可以編譯通過;
非運行時異常:表示程序編譯過程中就捕獲的異常,需要強制try catch或者throws拋出,程序運行時,一旦產生非運行時異常,程序無法編譯通過;
如何捕獲異常? 通過try catch finally try{表示放可能產生異常的程序} catch(可能產生的異常){如果符合該異常,此時執行該語句段,表示這里要處理該異常}finally{不論是否有異常都執行該語句段} Throws:在方法聲明時使用,表示該方法可能產生的異常,誰調用該方法,誰捕獲處理;當前方法不處理不捕獲
Throw:表示拋出一個具體異常,使用在方法體中;例如:throw new Exception(“異常消息”);
6、String和StringBuffer區別?為什么用StringBuffer拼字符串? String 表示不可長度字符串,finally不可被繼承的類;
StringBuffer:表示可變長度字符串,通過append方法追加字符串,默認有16位緩沖區,時能new實例化賦值,不能=號賦值;
使用StringBuffer拼接字符串以為StringBuffer長度可變,并且通過append方法追加字符串,節省內存:例如: “a”+”b”+”c” 此時字符串池中有: a b c ab
abc幾個字符串;而通過StringBuffer:
則字符串池中有: a
b c 和 abc
7、線程和進程區別?如何理解鎖?
線程:一段可執行的代碼段;多個線程共同完成一個任務; 進程:一個可執行的應用程序;
解決死鎖可以通過:synchronized 關鍵詞,實現多個線程中不同方法,在同一時間內,只能有一個線程在執行;其他線程等待,直到該線程釋放資源;
8、Wait和sleep方法區別?
Wait方法是object類中的,sleep是Thread類中的
9、如何定義一個線程?
重寫Thread類中的Run方法,或者實現Runnable接口中Run方法
10、Collection和Collections區別
Collection是集合接口,Collections是封裝了操作集合方法的類;
11、Set和List區別
Set無序,不可以重復;
List有序,可以重復;
12、LinkedList和vector以及ArrayList區別 LinkedList: 鏈表實現,對該集合新增修改刪除數據速度快,效率高,線程不安全; Arraylist:數組實現,對該集合操作時,從該集合中查詢數據速度快,效率高,線程不安全;
Vector: 數組實現,線程安全,效率低;
13、HashMap和HashTable區別:
HasMap: 鍵值對可以為空;線程不安全;
HashTable: 鍵值對不可以為空;線程安全;
14、PreparedStatement 和Statement區別:
前者使用預編譯sql,效率高,安全,后者未采用預編譯sql,效率低;
15、名詞解釋: jdbc、JNDI、BI、VO、DAO、IOC、AOP、OOP、DI(依賴注入)、MVC、ORM(關系映射模型)、盒子模型、JDBC:java 數據庫鏈接;即:java提供操作數據庫的東西; JNDI:java 命名目錄接口; BI:商業智能; VO:值對象;
DAO:數據訪問對象也就是:java訪問數據庫的第一層接口; IOC:控制翻轉;(Spring時候講)AOP:面向切面編程(Spring講)OOP:面向對象編程; DI: MVC:是一種開發模式,M:model模型層,V view 視圖層 C Controller 控制層;
控制層主要負責模型層以及視圖層數據交互;
ORM:關系映射模型;(Hibernate,Mybatis等都是ORM框架)
盒子模型:css中的一種模型;將頁面元素認為是現實中盒子,他們都具有border 邊框 Content內容,padding(補白)內邊距 margin外邊距 等特點,這就是盒子模型;
16、接口和抽象類區別?為什么用接口(彌補java單繼承特點)?為什么用抽象類(提取公共部分內容,達到代碼復用目的和多態)?
接口:是Interface,是一種特殊的抽象類,為了彌補java單繼承的特點,接口可以繼承多個接口,也可以實現多個類,聲明的變量為常量,方法默認public 省略abstract關鍵詞;
使用時必須通過類重寫里面所有抽象方法;
抽象類: 是abstract 聲明的類,可以有抽象方法,也可以有非抽象方法;
不能被實例化,只能通過子類繼承重寫里面所有抽象方法,通過實例化子類使用;
用抽象類可以提取公共部分,然后子類重寫相關方法或者抽象方法,實現多態以及程序的復用;
接口目的就是為了彌補單繼承缺點;因為接口可以彌補多繼承;
17、Break(退出整個循環)、continue(退出當前循環,只能用于循環或者switch語句)和return(退出整個方法體表示該方法有返回值)區別
18、Finally(異常語句塊中的,表示有無異常都執行該方法體)、final(聲明變量為常量,聲明類不可被繼承)、finalize(垃圾回收機制中自動調用的方法)區別
19、如何獲取隨機小數?如何獲取隨機整數?
Math.random()
Random.類 20、io流的種類? 哪里用到了io流,?什么時候用字節流,什么時候用字符流?
說一下你用過的流有哪些?
(1)字節流和字符流
(2)文件上傳下載以及解析xml時加載文件等,還有某些框架底層用到了
(3)讀取文件內容,即文本,使用字符流,其他情況都是用字節流
(4)字節流: InputStram,OutputStream FileInputStram、FileOutputStream
BufferedInputStream。BufferedOutputStream
字符流:Reader、Writer、BufferedReader、BufferedWriter、FileReader、FileWriter、InputStreamReader、OutputStreamWriter
21、內部類種類?
匿名內部類、非靜態內部類、靜態內部類、局部內部類
22、list、set如何重新排序?如何讓set有序?
重寫Comparable 以及Comparator 中的comparaTo以及compare方法
23、重寫以及重載區別?
重寫發生在繼承中,子類繼承父類,要求子類方法與父類方法名,參數個數,返回值必須相同;
重載是發生在當前類中,方法名相同,參數個數不同,類型不同即可;
24、Static用法:
static表示聲明的變量或者方法只能被實例化一次,并且被一個對象的不同實例共享,類名可直接打點調用;
25、super和this區別?
Super調用父類對象,使用時如果在子類構造方法中,必須寫第一行,不能用在static中;
This表示當前類對象,不能用static中;
26、Jsp的兩中包含:
動態包含,被包含頁面不獨立存在,先包含進來在編譯;
<%@include> 靜態包含,被包含的頁面獨立存在,先編譯完畢后再包含進來;
27、jsp的就個內置對象:
out、page、request、session、application、config、pageContext、exception、response
四個作用域: page(最小)、request、session、application(最大)
28、過濾器用在哪兒?
即:filter,可以實現權限控制以及轉碼,某些框架中也使用了(struts2)
29、監聽器? Session、request、application(ServletContex類型)
監聽在線人數、通過application初始化時加載數據或者配置; 30、servlet的聲明周期?
服務器加載后,servlet容器通過init方法初始化,然后客戶端訪問服務器時,經過servlet的指定的urlpattern,然后進入指定servlet類中的service方法處理業務邏輯,然后響應給客戶端,服務器關閉通過destory方法銷毀servlet容器;
31、Session和Cookie區別:
Session’表示一次會話,客戶端訪問服務器端,會有唯一session表示該客戶端,有一個sesionid是唯一的; 瀏覽器關閉只能是斷開會話,而session依然存在,直到過期或者手動銷毀;(web.xml中可以設置或者通過set...方法設置有效時間)
Session是保留在服務器端的;過多使用給服務器端帶來壓力; Cookie是鍵值對存儲數據,保留在客戶端不安全;
32、Jsp中的<%%> <%!%> <=%>區別
<%%> 可以聲明變量也可以寫操作;
<%!%> 只能用于聲明變量,聲明變量是全局的;
<%=%> 表示輸出,顯示某個字段值,類似于out.print();
33、客戶端跳轉(重定向)或者服務器端跳轉(轉發)區別?
客戶端跳轉當頁面刷新時,不會再次發送請求,以前的request中存放的變量全部失效,并進入一個新的request作用域。
服務器端跳轉當刷新頁面會再次提交請求,并且服務器端跳轉時以前的request中存放的變量不會失效。
34、初始化快和靜態初始化塊區別:
類中寫static{}永遠只加載一次,單利的、比構造方法早
類中寫{} 每次加載類都執行,比構造方法早
35、為什么用構造方法?(初始化成員變量使用的)
36、Js如何操作DOM?什么是DOM(文本對象模型)?
(1)按照id獲取對象、按照name屬性獲取、按照標簽獲取、按照form找
document.getElementById(“”)
document.getElementsByName(“”)document.getElementsByTagName(“”)Document.forms[0].id或者name屬性
38、如何js創建一個節點?如何用jquery創建一個節點?
Js: document.createElement(“標簽名”)Jquery: $(“