高分求英文解释以下基本概念

bitileaves 2006-11-21 01:36:50
周五要参加一家公司的英语电话面试,事前明确说了要用英文回答一些基础技术问题.我英文不好,现在好紧张.请大家多多帮忙呀.

类似于:
override, overload 的区别
final, finally, finalize的区别
面向对象,面向过程的区别
...
...

还有很多一些基本概念,怎么用英文来解释。
中文的我是知道回答的,所以请大家帮忙,回复的都有分送!
...全文
222 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
bitileaves 2006-11-21
  • 打赏
  • 举报
回复
谢谢大家的回复.
尤其感谢 liufei8463(武汉小兵) !
zxm_dgcstars 2006-11-21
  • 打赏
  • 举报
回复
楼上兄弟的英语不错,我与楼主存在同样的问题----英语差
liufei8463 2006-11-21
  • 打赏
  • 举报
回复
http://www.techinterviews.com/?p=214
你看看这个英文网站吧,基础概念基本都有
liufei8463 2006-11-21
  • 打赏
  • 举报
回复
final : final keyword can be used for class, method and variables. A final class cannot be subclassed and it prevents other programmers from subclassing a secure class to invoke insecure methods. A final method can’t be overridden. A final variable can’t change from its initialized value. finalize() : finalize() method is used just before an object is destroyed and can be called just prior to garbage collection. finally : finally, a key word used in exception handling, creates a block of code that will be executed after a try/catch block has completed and before the code following the try/catch block. The finally block will execute whether or not an exception is thrown. For example, if a method opens a file upon exit, then you will not want the code that closes the file to be bypassed by the exception-handling mechanism. This finally keyword is designed to address this contingency.
liufei8463 2006-11-21
  • 打赏
  • 举报
回复
Overloading methods
Overloading of methods is a compiler trick to allow you to use the same name to perform different actions depending on parameters.

Thus imagine you were designing the interface for a system to run mock Java certification exams (who could this be?). An answer may come in as an integer, a boolean or a text string. You could create a version of the method for each parameter type and give it a matching name thus

markanswerboolean(boolean answer){
}
markanswerint(int answer){
}

markanswerString(String answer){
}


This would work but it means that future users of your classes have to be aware of more method names than is strictly necessary. It would be more useful if you could use a single method name and the compiler would resolve what actual code to call according to the type and number of parameters in the call.

This is the heart of overloading methods, part of what is known as polymorphism.

There are no keywords to remember in order to overload methods, you just create multiple methods with the same name but different numbers and or types of parameters. The names of the parameters are not important but the number and types must be different. Thus the following is an example of an overloaded markanswer method

void markanswer(String answer){
}
void markanswer(int answer){
}


The following is not an example of overloading and will cause a compile time error indicating a duplicate method declaration.

void markanswer(String answer){
}

void markanswer(String title){
}

The return type does not form part of the signature for the purpose of overloading.

Thus changing one of the above to have an int return value will still result in a compile time error, but this time indicating that a method cannot be redefined with a different return type.

Overloaded methods do not have any restrictions on what exceptions can be thrown. That is something to worry about with overriding.


Overriding methods
Overriding a method means that its entire functionality is being replaced. Overriding is something done in a child class to a method defined in a parent class. To override a method a new method is defined in the child class with exactly the same signature as the one in the parent class. This has the effect of shadowing the method in the parent class and the functionality is no longer directly accessible.

Java provides an example of overriding in the case of the equals method that every class inherits from the granddady parent Object. The inherited version of equals simply compares where in memory the instance of the class references. This is often not what is wanted, particularly in the case of a String. For a string you would generally want to do a character by character comparison to see if the two strings are the same. To allow for this the version of equals that comes with String is an overriden version that performs this character by character comparison.

andybogard 2006-11-21
  • 打赏
  • 举报
回复
override重写, overload重载
final最终(定义常量), finally在try|catch|最后用的, finalize
面向对象 OO,面向过程OP
caizhh 2006-11-21
  • 打赏
  • 举报
回复
你先用中文把答案写下来,然后翻译成英文不行吗?
中间可能需要了解一些专业词汇
luyang1016 2006-11-21
  • 打赏
  • 举报
回复
lz找点英文书看看吧。上网下载个 thinking in java, 前几章就有介绍的

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧