Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

search topic

Monday, October 6, 2008

Core Java Interview Questions Part-7

Iterator differ from enumeration in two ways Iterator allow the caller to remove elements from the underlying collection during the iteration with well-defined semantics. And , method names have been improved.

98 Q What is the Locale class?

A Locale object represents a specific geographical, political, or cultural region

99 Q What is internationalization?

Internationalization is the process of designing an application so that it can be adapted to various languages and regions without changes.

100 Q What is anonymous class ?

A An anonymous class is a type of inner class that don't have any name.

101 Q What is the difference between URL and URLConnection?

A URL represents the location of a resource, and a URLConnection represents a link for accessing or communicating with the resource at the location.

102 Q What are the two important TCP Socket classes?

ServerSocket and Socket. ServerSocket is useful for two-way socket communication. Socket class help us to read and write through the sockets. getInputStream() and getOutputStream() are the two methods available in Socket class.

103 Q Strings are immutable. But String s="Hello"; String s1=s+"World" returns HelloWorld how ?

Here actually a new object is created with the value of HelloWorld

104 Q What is classpath?

Classpath is the path where Java looks for loading class at run time and compile time.

105 Q What is path?

It is an the location where the OS will look for finding out the executable files and commands.

106 Q What is java collections?

Java collections is a set of classes, that allows operations on a collection of classes.

107 Q Can we compile a java program without main?

Yes, we can. In order to compile a java program, we don't require any main method. But to execute a java program we must have a main in it (unless it is an applet or servlet). Because main is the starting point of a java program.

108 Q What is a java compilation unit.

A compilation unit is a java source file.

109 What are the restrictions when overriding a method ?

Overridden methods must have the same name, argument list, and return type (i.e., they must have the exact signature of the method we are going to override, including return type.) The overriding method cannot be less visible than the method it overrides( i.e., a public method cannot be override to private). The overriding method may not throw any exceptions that may not be thrown by the overridden method

110 Q What is static initializer block? What is its use?

A static initializer block is a block of code that declares with the static keyword. It normally contains the block of code that must execute at the time of class loading. The static initializer block will execute only once at the time of loading the class only.

No comments: