- 浏览: 19482 次
文章分类
最新评论
think in java interview-高级开发人员面试宝典(五)
这次开始我们来点洋文吧。
有些基础,大家可能用中文知道如何表示,但是面试官如果让你用全英语表达你就不知道如何去说了,那么下面我们将给出对于一些常用的JAVA基础知识的英语问答以及相关的答案。
大家可以看一下如何用英语去回答这些基础的问题,找一下感觉。
Overriding & Overloading
Overriding - same method names with same arguments and same return types associated in a class and its subclass.
Overloading - same method name with different arguments, may or may not be same return type written in the same class itself.
What's the difference between an interface and an abstract class?
- An abstract class may contain code in method bodies, which is not allowed in an interface. With abstract classes, you have to inherit your class from it and Java does not allow multiple inheritance. On the other hand, you can implement multiple interfaces in your class.
- What’s the difference between Hashtable and Hashmap
- They Both provide key-value access to data.
- The key difference between the two is that access to the Hashtable is synchronized on the table while access to the HashMap isn't. You can add it, but it isn't there by default.
- Another difference is that iterator in the HashMap is fail-safe while the enumerator for the Hashtable isn't.
- And, a third difference is that HashMap permits null values in it, while Hashtable doesn't.
What do you understand by Synchronization?
Synchronization is a process of controlling the access of shared resources by the multiple threads in such a manner that only one thread can access one resource at a time. In non synchronized multithreaded application, it is possible for one thread to modify a shared object while another thread is in the process of using or updating the object's value. Synchronization prevents such type of data corruption.
Synchronized statement and Synchronized block
Synchronized methods are methods that are used to control access to an object. A thread only executes a synchronized method after it has acquired the lock for the method'sobject or class. Synchronized statements are similar to synchronized methods, always use synchronized(this) to instead of.What is difference between jdbc3.0 and jdbc2.0? What’s the new features in jdbc3.0?
这道题可见老外的面试对基础是多么的重视,回答时掌握好6点
The JDBC 3.0 API introduces new material and changes in these areas:
1. Savepoint support
Added the Savepoint interface, which contains new methods to set, release, or roll back a transaction to designated savepoints.
2. Reuse of prepared statements by connection pools
Added the ability for deployers to control how prepared statements are pooled and reused by connections.
3. Connection pool configuration Defined a number of properties for the ConnectionPoolDataSource interface.
These properties can be used to describe how pooledConnection objects created by DataSource objects should be pooled.
4. Retrieval of parameter metadata
Added the interface ParameterMetaData, which describes the number, type and properties of parameters to prepared statements.
5. Retrieval of auto-generated keys
Added a means of retrieving values from columns containing automatically generated values.
6. Ability to have multiple open ResultSet objects
Added the new method getMoreResults(int), whichtakes an argument that specifies whether ResultSet objects returned by a Statement object should be closed before returning any subsequent ResultSet objects.
What's the difference between the methods sleep() and wait()
简单了不能再简单的一道题了,可是用英语如何回答呢?来!
The code sleep(1000); puts thread aside for exactly one second. The code wait(1000), causes a wait of up to one second. A thread could stop waiting earlier if it receives the notify() or notifyAll() call. The method wait() is defined in the class Object and the method sleep() is defined in the class Thread
What is oops
OOPs is the new concept of programming parallel to Procedure oriented programming
There are three main principals of oops which are called Polymorphism, Inheritance and Encapsulation
It help in programming approach in order to built robust user friendly and efficient softwares and provide the efficient way to maintain real world softwares..
What is Authentication & Authorization
这道题很猛,来自于Oracle的一次面试。
Fundamentally, authentication is performed by a series of Spring Security filter (implementations of J2EE Servlet Filters) chains, linked together. Each element in a given chain has a dedicated responsibility, while each chain is responsible for accomplishing high-level goals towards the handling of a request. Ultimately, these chains must prepare a request to fulfill a single contract enforced by the last link in the primary security filter chain.
Authentication
An authentication system is how you identify yourself to the computer. The goal behind an authentication system is to verify that the user is actually who they say they are.There are many ways of authenticating a user. Any combination of the following are good examples.
Password based authentication
Requires the user to know some predetermined quantity (their password).- Advantages: Easy to impliemnt, requires no special equipemnt.
- Disadvantages: Easy to forget password. User can tell another user their password. Password can be written down. Password can be reused.
Device based authentication
Requires the user to posses some item such as a key, mag strip, card, s/key device, etc.- Advantages: Difficult to copy. Cannot forget password. If used with a PIN is near useless if stolen.
- Disadvantages: Must have device to use service so the user might forget it at home. Easy target for theft. Still doesn't actually actively identify the user.
Biometric Authentication
- My voice is my passport. Verify me. This is from the movie sneakers and demonstrates one type of biometric authentication device. It identifies some physical charactistic of the user that cannot be seperated from their body.
Retina Scanners
- Advantages: Accurately identifies the user when it works.
- Disadvantages: New technology that is still evolving. Not perfect yet.
Hand Scanners
- Advantages: Difficult to seperate from the user. Accurately identifies the user.
- Disadvantages: Getting your hand stolen to break into a vault sucks a lot more than getting your ID card stolen.
Authorization
Once the system knows who the user is through authentication, authorization is how the system decides what the user can do.A good example of this is using group permissions or the difference between a normal user and the superuser on a unix system.
There are other more compicated ACL (Access Control Lists) available to decide what a user can do and how they can do it. Most unix systems don't impliment this very well (if at all.)
What is generic type?
中文回答一下,谁都可以答得出,够简单吧,试着用英语回答呢?
When you take an element out of a Collection, you must cast it to the type of element that is stored in the collection. Besides being inconvenient, this is unsafe. The compiler does not check that your cast is the same as the collection's type, so the cast can fail at run time.Generics provides a way for you to communicate the type of a collection to the compiler, so that it can be checked. Once the compiler knows the element type of the collection, the compiler can check that you have used the collection consistently and can insert the correct casts on values being taken out of the collection.
What is autoboxing and unboxing?
很多人中文可能都不一定回答得出这道题,自动装箱,折箱,忘了吧?
Autoboxing, introduced in Java 5, is the automatic conversion the Java compiler makes between the primitive (basic) types and their corresponding object wrapper classes (eg, int and Integer, double and Double, etc). The underlying code that is generated is the same, but autoboxing provides a sugar coating that avoids the tedious and hard-to-read casting typically required by Java Collections, which can not be used with primitive types.What is equals() and hashcode()
又来了,具体原理和算法看:hashcode & equals之5重天
Java.lang.Object has methods called hasCode() and equals(). These methods play a significant role in the real time application. However its use is not always common to all applications. In some case these methods are overridden to perform certain purpose. In this article I will explain you some concept of these methods and why it becomes necessary to override these methods.
hashCode()
As you know this method provides the has code of an object. Basically the default implementation of hashCode() provided by Object is derived by mapping the memory address to an integer value. If look into the source of Object class , you will find the following code for the hashCode.
public native int hashCode();
It indicates that hashCode is the native implementation which provides the memory address to a certain extent. However it is possible to override the hashCode method in your implementation class.
equals()
This particular method is used to make equal comparison between two objects. There are two types of comparisons in Java. One is using “= =” operator and another is “equals()”. I hope that you know the difference between this two. More specifically the “.equals()” refers to equivalence relations. So in broad sense you say that two objects are equivalent they satisfy the “equals()” condition. If you look into the source code of Object class you will find the following code for the equals() method
下面开始来几道J2EE的面试题
What is the Lazy Loading
Lazy loading in Hibernate means fetching and loading the data,only when it is needed, from a persistent storage like a database.
Lazy loading improves the performance of data fetching and significantly reduces the memory footprint.
In Hibernate, there are two main components which can be lazy loaded.
They are namely Entities and Collections.
An Entity represents a relational data in database, whereas a collection represents collection of children for an entity.
What is MVC
Model–view–controller (MVC) is an architecturalpattern used in softwareengineering. Successful use of the pattern isolates business logic from user interface considerations, resulting inan application where it is easier to modify either the visual appearance of theapplication or the underlying business rules without affecting the other
Model
Business logic goes here
View
Presentation logic goes here
Controller
Application logic goes here
What is Spring
Springfeature:
The Spring Framework comprisesseveral modules that provide a range of services:
- Inversion of Control container: configuration of application components and lifecycle management of Java objects
- Aspect-oriented programming: enables implementation of cross-cutting routines
- Data access: working with relational database management systems on the Java platform using JDBC and object-relational mapping tools
- Transaction management: unifies several transaction management APIs and coordinates transactions for Java objects
- Model-view-controller: an HTTP and Servlet-based framework providing hooks for extension and customization
- Remote Access framework: configurative RPC-style export and import of Java objects over networks supporting RMI, CORBA and HTTP-based protocols including web services (SOAP)
- Batch processing: a framework for high-volume processing featuring reusable functions including logging/tracing, transaction management, job processing statistics, job restart, skip, and resource management
- Authentication and authorization: configurable security processes that support a range of standards, protocols, tools and practices via the Spring Security sub-project (formerly Acegi).
- Remote Management: configurative exposure and management of Java objects for local or remote configuration via JMX
- Messaging: configurative registration of message listener objects for transparent message consumption from message queues via JMS, improvement of message sending over standard JMS APIs
- Testing: support classes for writing unit tests and integratio
Why use hibernate
1. Hibernate generates very efficient queries very consistently
Hibernateemploys very agressive, and very intelligent first and second level cachingstrategy.
Thisis a major factor in acheiving the high scalability.
2. Cross-Database You only have to change the databasedialect.
What is dependency-injection
Software components (Clients), are often a part of a set of collaborating components which depend upon other components (Services) to successfully complete their intended purpose. In many scenarios, they need to know “which” components to communicate with, “where” to locate them, and “how” to communicate with them. When the way such services can be accessed is changed, such changes can potentially require the source of lot of clients to be changed.One way of structuring the code is to let the clients embed the logic of locating and/or instantiating the services as a part of their usual logic. Another way to structure the code is to have the clients declare their dependency on services, and have some "external" piece of code assume the responsibility of locating and/or instantiating the services and simply supplying the relevant service references to the clients when needed.
What's difference between criterial query and hql:
Criteria is an object-oriented API, while HQL means string concatenation. That means all of the benefits of object-orientedness apply:
1. All else being equal, the OO version is somewhat less prone to error. Any old string could get appended into the HQL query, whereas only valid Criteria objects can make it into a Criteria tree. Effectively, the Criteria classes are more constrained.
2. With auto-complete, the OO is more discoverable (and thus easier to use, for me at least). You don't necessarily need to remember which parts of the query go where; the IDE can help you
3. You also don't need to remember the particulars of the syntax (like which symbols go where). All you need to know is how to call methods and create objects.
Since HQL is very much like SQL (which most devs know very well already) then these "don't have to remember" arguments don't carry as much weight. If HQL was more different, then this would be more importatnt.
Pls tell me the advantage points or new features of Spring FrameWork?
The Spring Framework comprises several modules that provide a range of services:
Inversion of Control container: configuration of application components and lifecycle management of Java objects
Aspect-oriented programming: enables implementation of cross-cutting routines
Data access: working with relational database management systems on the Java platform using JDBC and object-relational mapping tools
Transaction management: unifies several transaction management APIs and coordinates transactions for Java objects
Model-view-controller: an HTTP and Servlet-based framework providing hooks for extension and customization
Remote Access framework: configurative RPC-style export and import of Java objects over networks supporting RMI, CORBA and HTTP-based protocols including web services (SOAP)
Batch processing: a framework for high-volume processing featuring reusable functions including logging/tracing, transaction management, job processing statistics, job restart, skip, and resource management
Authentication and authorization: configurable security processes that support a range of standards, protocols, tools and practices via the Spring Security sub-project (formerly Acegi).
Remote Management: configurative exposure and management of Java objects for local or remote configuration via JMX
Messaging: configurative registration of message listener objects for transparent message consumption from message queues via JMS, improvement of message sending over standard JMS APIs
Testing: support classes for writing unit tests and integratio
What is spring transaction managerment?
Spring provides a consistent abstraction for transaction management. This abstraction is one of the most important of Spring's abstractions, and delivers the following benefits:
Provides a consistent programming model across different transaction APIs such as JTA, JDBC, Hibernate, iBATIS Database Layer and JDO.
Provides a simpler, easier to use, API for programmatic transaction management than most of these transaction APIs
Integrates with the Spring data access abstraction
Supports Spring declarative transaction management
the difference between BeanFactory and ApplicationContext ?
Two of the most fundamental and important packages in Spring are the org.springframework.beans and org.springframework.context packages. Code in these packages provides the basis for Spring's Inversion of Control (alternately called Dependency Injection) features. The BeanFactory provides an advanced configuration mechanism capable of managing beans (objects) of any nature, using potentially any kind of storage facility. The ApplicationContext builds on top of the BeanFactory (it's a subclass) and adds other functionality such as easier integration with Springs AOP features, message resource handling (for use in internationalization), event propagation, declarative mechanisms to create the ApplicationContext and optional parent contexts, and application-layer specific contexts such as the WebApplicationContext, among other enhancements.Tell me what is AOP?
1. Aspect: A modularization of a concern that cuts across multiple objects. Transaction management is a good example of a crosscutting concern in J2EE applications.2. Join point
3. Advice
4. Pointcut
5. Introduction
6. Target object
7. Weaving
How many Types of advice are there in Spring Framework:
- Before advice
- After returning advice
- After throwing advice
- After (finally) advice
- Around advice
相关推荐
### 《Think-in-JAVA-4th-Edition》核心知识点概览 #### 一、书籍简介 《Thinking in Java》是一本由Bruce Eckel撰写的经典Java编程书籍,被誉为是学习Java的最佳参考资料之一。该书适合具有一定Java基础的学习者...
《Think in Java》是Java编程领域的一本经典著作,由Bruce Eckel撰写,中文版的出现使得更多中国程序员能够深入理解和掌握Java编程语言的核心概念。这本书以其深入浅出的讲解方式,深受程序员们的喜爱,是许多初学者...
think in java 文档
《Think in Java 3》是一本深受欢迎的Java编程指南,由Bruce Eckel撰写,它以其详尽的解释和丰富的示例闻名。这本书是许多Java初学者和专业开发者的重要参考资料,旨在帮助读者深入理解Java语言的核心概念和机制。...
《Think in Java》是Java编程领域的一本经典著作,由Bruce Eckel撰写,深受程序员喜爱。这本书通过深入浅出的方式讲解了Java语言的核心概念和技术,包括面向对象编程、数据结构、算法以及网络编程等多个方面。"Think...
《Think in Java》是Bruce Eckel的经典编程教材,它深入浅出地讲解了Java语言的基础概念和高级特性。源码整理则为读者提供了实践和学习的机会,帮助理解书中的示例和理论。以下是对《Think in Java》源码中一些重要...
Think in java 源码构建编译
《Think in Java》是 Bruce Eckel 的经典著作,它深入浅出地讲解了Java编程语言的核心概念和技术。这本书强调理解编程思想,而不仅仅是学习语法。练习题是学习过程中的重要部分,它们帮助我们巩固理论知识,提升实际...
java think in java (英文第四版)至今为止 被认为是java教程之中权威作品之一
作者:贯穿本书,我试图在您的大脑里建立一个模型——或者说一个“知识结构”。这样可加深对语言的理解。若遇到难解之处,应学会把它填入这个模型的对应地方,然后自行演绎出答案。事实上,学习任何语言时,脑海里有...
《Think In Java 4》是Java编程领域里一本极具影响力的著作,由资深程序员 Bruce Eckel 编著。这本书以其深入浅出的讲解方式和全面的知识覆盖而闻名,被誉为Java学习者的经典读物。中文版的完美高清版本为国内读者...
Java初学入门——《Think in Java》精要 在编程世界中,Java是一种广泛应用的面向对象的编程语言,尤其在企业级应用开发中占据主导地位。对于初学者来说,掌握Java的基本概念和语法是至关重要的。《Think in Java》...
Think Data Structures in Java 英文azw3 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
think in java 第四版 源码以及作业 eclipse版本 包含jar包 可以直接导入eclipse
1.11 Java和因特网 1.11.1 什么是Web? 1.11.2 客户端编程 1.11.3 服务器端编程 1.11.4 一个独立的领域:应用程序 1.12 分析和设计 1.12.1 不要迷失 1.12.2 阶段0:拟出一个计划 1.12.3 阶段1:要制作什么?...
Think-In-Java-Code Thinking In Java 书中源码以及课后练习代码(从第7章开始随着看书的进度一步步更新) 第七章 复用类 7.1 组合语法 7.2 继承语法 7.2.1 初始化基类 7.3 代理 7.4 结合使用组合和继承 7.4.1 确保...
《ThinkSystem RAID 530-8i驱动在Server 2016及2012中的应用详解》 在IT行业中,服务器硬件的稳定性和性能是至关重要的,特别是存储设备,它直接关系到数据的安全性和系统运行效率。联想ThinkSystem系列服务器以其...
《Think in Java 4》是Java编程领域的一部经典之作,由Bruce Eckel撰写,它以其深入浅出的讲解方式和丰富的示例代码深受程序员喜爱。这个压缩包包含的就是这本书的全部源代码,旨在帮助读者更好地理解和实践书中所...
《Think in Java 中文第四版》是学习Java编程的经典之作,由Bruce Eckel撰写,它深入浅出地讲解了Java语言的核心概念和技术。本部分主要涵盖的是书籍的第二部分,通常涉及面向对象编程的深入探讨,包括类、对象、...