java经典英文面试题,Java-英文面试题-经典

资源描述:

英文Java面试题 Question What is transient variable Answer Transient variable can t be serialize. For example if a variable is declared as transient in a Serializable class and the class is written to an ObjectStream, the value of the variable can t be written to the stream instead when the class is retrieved from the ObjectStream the value of the variable becomes null. Question Name the containers which uses Border Layout as their default layout Answer Containers which uses Border Layout as their default are window, Frame and Dialog classes. Question What do you understand by Synchronization Answer 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. E.g. Synchronizing a function public synchronized void 1 { // Appropriate -related code. } E.g. Synchronizing a block of code inside a function public myFunction { synchronized this { // Synchronized code here. } } Question What is Collection API Answer The Collection API is a set of classes and interfaces that support operation on collections of objects. These classes and interfaces are more flexible, more powerful, and more regular than the vectors, arrays, and hashtables if effectively replaces. Example of classes HashSet, HashMap, ArrayList, LinkedList, TreeSet and TreeMap. Example of interfaces Collection, Set, List and Map. Question Is Iterator a Class or Interface What is its use Answer Iterator is an interface which is used to step through the elements of a Collection. Question What is similarities/difference between an Abstract class and Interface Answer Differences are as follows Interfaces provide a of multiple inheritance. A class can extend only one other class. Interfaces are limited to public s and constants with no implementation. Abstract classes can have a partial implementation, protected parts, static s, etc. A Class may implement several interfaces. But in case of abstract class, a class may extend only one abstract class. Interfaces are slow as it requires extra indirection to find corresponding in the actual class. Abstract classes are fast. Similarities Neither Abstract classes or Interface can be instantiated. Question How to define an Abstract class Answer A class containing abstract is called Abstract class. An Abstract class can t be instantiated. Example of Abstract class abstract class testAbstractClass { protected String myString; public String getMyString { return myString; } public abstract

展开阅读全文

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值