Update: 2007.6.26 By: BorderJava面试题TOP10:
JAVA, JSP, SERVLETS, EJB, STRUTS, XML, ANT, LOG4J, WEBLOGIC ... 都有
可以在Goolge.com中搜
java interview questions 或
java 面试题。
如果英语好的还是建议看看英文的,中问的搜来搜去还都是那些东西。
例如:
1.
Why do we need public static void main(String args[]) method in Java We need
public: The method can be accessed outside the class package
static: You need not have an instance of the class to access the method
void: Your application need not return a value, as the JVM launcher would return the value when it exits
main(): This is the entry point for the application
If the main() was not static, you would require an instance of the class in order to execute the method.
If this is the case, what would create the instance of the class? What if your class did not have a public constructor?
2.
Explain serialization Serialization means storing a state of a java object by coverting it to byte stream
3.
What are the rules of serialization Rules:
1. Static fileds are not serialized because they are not part of any one particular object
2. Fileds from the base class are handled only if hose are serializable
3. Transient fileds are not serialized
4.
Is Empty .java file a valid source file? Yes, an empty .java file is a perfectly valid source file.
[Received from Sandesh Sadhale]
5. Is main a keyword in Java?
No, main is not a keyword in Java.
6.What happens if you dont initialize an instance variable of
any of the primitive types in Java?
Java by default initializes it to the default value for that primitive type.
Thus an int will be initialized to 0, a boolean will be initialized to false.
7. How many objects are created in the following piece of code?
MyClass c1, c2, c3; c1 = new MyClass (); c3 = new MyClass ();
Only 2 objects are created, c1 and c3. The reference c2 is only declared and
not initialized.
8. What will be the default values of all the elements of an array defined as
an instance variable?
If the array is an array of primitive types, then all the elements of the array
will be initialized to the default value corresponding to that primitive type. e.g.
All the elements of an array of int will be initialized to 0, while that of boolean
type will be initialized to false. Whereas if the array is an array of references
(of any type), all the elements will be initialized to null.
9. difference between java.sql.Date and java.util.Date
1)
java.util.Date is the superclass for java.sql.Date i.e public class Date extends
java.util.Date { }
2) java.sql.Date is used for databases where we just need to store date and not
time but java.util.date returns Date as well as time
3) java.util.Date has constructor with 0 parameters but java.sql.Date does not
has the one, so we canot use new Date() here, time in milliseconds needs to be passed
10. 用UML画出你所熟悉的设计模式?
11. 什么是序列化?
序列化可以将对象写入字节流,他也可以从字节流中读取对象。将对象状态转换成字节流之后,
可以用java.io包中各种字节流类将其保存到文件中,管道到另一线程中或通过网络连接将对象数据发送到另一主机。
对象序列化功能非常简单、强大,在RMI、Socket、JMS、EJB都有应用。java核心类的许多类都实现了
java.io.Serializable接口而且,java的序列化比较简单,通常不需要编写保存和恢复对象状态的定制代码。
实现java.io.Serializable接口的类对象可以转换成字节流或从字节流恢复,不需要在类中增加任何代码。
--
Blog:
www.borderj.cnMSN:
borderj@live.comBorder
分享到:
相关推荐
java面试题集_java面试题集 java面试题集_java面试题集 java面试题集_java面试题集 java面试题集_java面试题集
Java面试题大全_300个以上面试题加答案_最后附加例子.doc
JAVA就业面试题264道_以及答案 JAVA就业面试题264道_以及答案 JAVA就业面试题264道_以及答案 JAVA就业面试题264道_以及答案 JAVA就业面试题264道_以及答案 JAVA就业面试题264道_以及答案 JAVA就业面试题264道_以及...
java 2018 最新面试大纲以及部分面试题
JAVA面试题集_免费下载
JAVA面试题(_华为)(答案).pdf
JAVA面试题集,看一看吧,会有收获的,兄弟们
java面试题包括基础和提高部分,是毕业生复习找工作的极好备战资料
有关java的面试题及相关解析教程,还是比较全面的
java面试题java面试题java面试题java面试题java面试题java面试题java面试题java面试题java面试题java面试题java面试题java面试题java面试题java面试题java面试题java面试题java面试题java面试题java面试题java面试题...
java面试题_java-interview-questions-master.zip2、在 Java 程序中怎么保证多线程的运行安全? 出现线程安全问题的原因一般都是三个原因: 1、 线程切换带来的原子性问题 解决办法:使用多线程之间同步...
Java Interview Notes_ 700 Java Interview Questions Answered.pdf
JAVA面试题JAVA面试题JAVA面试题JAVA面试题JAVA面试题JAVA面试题JAVA面试题JAVA面试题JAVA面试题
java面试题,最新50题,带答案.初级工程师,可以下载看看
100IT名企java面试必考面试题 你不清楚的18个非技术面试题是这些
面试题包含了不同技术层面的面试问题,同时也能对一些没有面试开发经验的小白给予不可估量的包装, 让你的薪水绝对翻倍, 本人亲试有效.Java面试题84集、java面试专属及面试必问课程,所有的面试题有视屏讲解, 解答方案....
直击面试系列_破解Java面试题_全 直击面试系列_破解Java面试题_全
很好的一份JAVA面试题集,共分十部分,从基础到高级,core Java OOAD&UML JDBC&Hibernate EJB&Spring WEB C++ WEBligic 及其他