java面试题 英文_JAVA面试题和答案(英文版).pdf

Java面试题和答案 (英文版)

Q:What isthe difference betweenan Interface and anAbstract class?

A:Anabstract class can have instance methods that implement a default behavior.An Interface canonly

declareconstants and instance methods, but cannot implement default behaviorandallmethodsare implicitly

abstract.An interface has all public members and no implementation.Anabstract class is a class which may

have the usualflavors of class members (private, protected, etc.), but has some abstract methods.

Q:What isthe purpose of garbage collection inJava, and when is it used?

A:The purpose of garbage collectionisto identify and discard objectsthat are no longerneeded by a program

so that their resources can be reclaimed and reused.A Java object is subject to garbage collectionwhen it

becomes unreachable to the program inwhich it is used.

Q:Describe synchronization in respect to multithreading.

A:With respect to multithreading,synchronizationisthe capability to controlthe access of multiplethreadsto

sharedresources.Withoutsynchonization,itispossibleforonethreadtomodifyasharedvariablewhileanother

thread is inthe process of using or updating same shared variable.This usually leads to significant errors.

Q:Explaindifferent way of using thread?

A:The thread could be implemented by using runnable interface or by inheriting fromtheThread class.The

former is more advantageous, 'cause whenyouare goingfor multiple inheritance..the only interface can help.

Q:What are pass by reference and passby value?

A:Pass By Reference meansthe passingthe address itself ratherthan passingthevalue.PassbyValue means

passing a copy of the value to be passed.

Q:What is HashMapand Map?

A:Map is Interface and Hashmap is class that implementsthat.

Q:Difference between HashMap and HashTable?

A:The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls.

(HashMapallows nullvalues as key and value whereas Hashtable doesnt allow).HashMap does not guaran

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值