GeekInterview.com
Series: Subject: Topic:

Java Interview Questions

Showing Questions 21 - 40 of 1118 Questions
First | Prev | | Next | Last Page
Sort by: 
 | 

Given the two methods:

Asked By: lalithakasiraj | Asked On: Dec 15th, 2012

Void f() throws ioexception which of the following is/are correct overriding method? a) void f() throws ioexception b) public void f() c) void f() throws filenotfoundexception d) void f() throws exception

Answered by: imAjit on: Dec 24th, 2012

a) void f() throws ioexception Bcoz the overriding method must NOT throw checked exceptions that are new or broader than those declared by the overridden method. For example, a method that declares a...

How many methods in the serializable interface?

Asked By: Interview Candidate | Asked On: Aug 28th, 2004

There is no method in the serializable interface. The serializable interface acts as a marker, telling the object serialization tools that your class is serializable.

Answered by: Prasad MN on: Dec 17th, 2012

There is no methods in serializable interface. It is a marker interface and null interface.

Answered by: ram on: Nov 22nd, 2012

Does not have any methods in Serializable interface......

What is the difference between class.Forname and registerdriver()

Asked By: Interview Candidate | Asked On: Aug 17th, 2005

Answered by: lokanath reddy on: Oct 25th, 2012

class.forName("full qualm name"); is used to load the driver explicitly and DriverManger.registerDriver(new classname()); will implicitly loads the driver automatically

Answered by: ruchi on: Jan 8th, 2006

class.forName() is a method ,this method takes a string representing a fully qualified class name(one that includes the package name) and loads the corresponding class.

What is the locale class

Asked By: Interview Candidate | Asked On: Aug 26th, 2004

The locale class is used to tailor program output to the conventions of a particulargeographic, political, orcultural region.

Answered by: pon suresh on: Oct 6th, 2012

what is object class in java?

Answered by: prabakaran29 on: Aug 19th, 2012

the locale class to used to tailor program output to the conventions of a particular geographic, political, or cultural region

Compareto and equals method

Asked By: cspatel | Asked On: Jul 3rd, 2012

Difference between compareto and equals method.

Answered by: Bharat on: Oct 1st, 2012

CompareTo method which is present in the String class is used to check the two strings. It checks each character with the other String and if found equals then returns 0. Else negative value or positi...

Answered by: Sandhya.Kishan on: Jul 13th, 2012

CompareTo() method is derived from Comparable interface and is used to find the Ordering of Strings.
equals() method is from java.lang.Object and used for comparing objects.

What is the difference between preemptive scheduling and time slicing

Asked By: Interview Candidate | Asked On: Aug 25th, 2004

Under preemptive scheduling, the highest priority task executes until it enters the waitingor dead states or a higher priority task comes into existence. Under time slicing, a taskexecutes for a predefined slice of time and then reenters the pool of ready tasks. Thescheduler then determines which task...

Answered by: Madhuri Hasure on: Sep 27th, 2012

Preemptive scheduling enables the highest priority task execution until waiting or dead states entered. It also executes, until a higher priority task enters. Time slicing allows a task to execute fo...

Answered by: Tejas Chavan on: Oct 18th, 2011

preemptive Scheduling:- the highest priority thread executes First that means when one thread is in running state that time the highest priority interrupt enters then this interrupt will executes firs...

What is the difference between list, set and map

Asked By: Interview Candidate | Asked On: Jul 21st, 2005

Answered by: Vinay on: Sep 4th, 2012

Adding couple of other differences between Set and Map:
1. You can have an iterator for a set but not a map.
2. Processing a complete map takes longer whereas processing a complete set takes a comparatively less time (reason - iterator)

Answered by: Pattukkottai Arun on: Jul 21st, 2005

A Set is a collection that has no duplicate elements.  
A List is a collection that has an order assoicated with its elements.  
A map is a way of storing key/value pairs. The way of storing a Map is similar to two-column table.

What is the difference between static and non-static variables

Asked By: Interview Candidate | Asked On: Aug 25th, 2004

A static variable is associated with the class as a whole rather than with specific instancesof a class. Non-static variables take on unique values with each object instance.

Answered by: vinodhini.A on: Aug 19th, 2012

STATIC VARIABLE

1)outclass is called static variable

2)static variable access member of its enclosing class through on object.

NON-STATIC VARIABLE

1)inner class is called non-static variable
2)nested class and it has access to all of the variable and methods object of its earlier.

Answered by: vishal on: Oct 7th, 2011

Static variable: 1)Memory allocated before creation of object. 2)static variables are class variables and the values remains same fr the whole class and its value is same for all classes in a program...

Can an unreachable object become reachable again

Asked By: Interview Candidate | Asked On: Aug 26th, 2004

An unreachable object may become reachable again. This can happen when the object'sfinalize() method isinvoked and the object performs an operation which causes it to become accessible toreachable objects.

Answered by: prabakaran29 on: Aug 19th, 2012

yes it is possible.using finalize in garbage collection

Answered by: Sandhya.Kishan on: Jul 31st, 2012

No, an unreachable object cannot be reached again.

What is the default size of vector, arraylist, hashtable, hashmAP, hashset in Java?

Asked By: V.shankar | Asked On: Jul 18th, 2007

Answered by: Dharmendra on: Aug 9th, 2012

ArrayList , Vector default size is 10. vector increment is 10 and array list is 10/2

Answered by: Ajay on: Nov 21st, 2011

Instead of 30 it would give 40.

What restrictions are placed on the values of each case of a switch statement

Asked By: Interview Candidate | Asked On: Aug 26th, 2004

During compilation, the values of each case of a switch statement must evaluate to avalue that can bepromoted to an int value.

Answered by: Sandhya.Kishan on: Jul 31st, 2012

1.The compiler does not initialize auto and register variables at the beginning of a switch body where as we can put data definitions at the beginning of the switch body.
2.We cannot use a switch statement to jump over initializations.

What is the difference between the paint() and repaint() methods

Asked By: Interview Candidate | Asked On: Aug 26th, 2004

The paint() method supports painting via a graphics object. The repaint() method is usedto cause paint() tobe invoked by the awt painting thread.

Answered by: Sandhya.Kishan on: Jul 31st, 2012

Whenever the window needs to be refreshed the paint() method is called automatically.The user does not specify the paint(). The user specifies the repaint() in order to obtain a rendering.repaint() i...

What method must be implemented by all threads

Asked By: Interview Candidate | Asked On: Aug 26th, 2004

All tasks must implement the run() method, whether they are a subclass of thread orimplement therunnable interface.

Answered by: Sandhya.Kishan on: Jul 31st, 2012

The run() method must be implemented by all the threads.

What is the difference between a public and a non-public class

Asked By: Interview Candidate | Asked On: Aug 26th, 2004

A public class may be accessed outside of its package. A non-public class may not beaccessed outside ofits package.

Answered by: Sandhya.Kishan on: Jul 31st, 2012

We can access a public class out of its package where as the access outside the package is not possible with a non public class.

What an i/o filter

Asked By: Interview Candidate | Asked On: Aug 26th, 2004

An i/o filter is an object that reads from one stream and writes to another, usuallyaltering the data in someway as it is passed from one stream to another.

Answered by: Sandhya.Kishan on: Jul 31st, 2012

To read from one stream and then to write on other stream we use i/o filter.

When is the finally clause of a try-catch-finally statement executed

Asked By: Interview Candidate | Asked On: Aug 26th, 2004

The finally clause of the try-catch-finally statement is always executed unless the threADOf executionterminates or an exception occurs within the execution of the finally clause.

Answered by: Sandhya.Kishan on: Jul 31st, 2012

The finally clause of a try-catch-finally statement executed when the thread of execution terminates or an exception occurs within the execution of the finally clause.

What is the relationship between a method's throws clause and the exceptionsthat can bethrown during the method's execution

Asked By: Interview Candidate | Asked On: Aug 26th, 2004

A method's throws clause must declare any checked exceptions that are not caught withinthe body of themethod.

Answered by: Sandhya.Kishan on: Jul 31st, 2012

Any checked exceptions that are not caught within the body of the method must declare in a methods throws clause.

What is the collection interface

Asked By: Interview Candidate | Asked On: Aug 26th, 2004

The collection interface provides support for the implementation of a mathematical bag -an unorderedcollection of objects that may contain duplicates.

Answered by: Sandhya.Kishan on: Jul 31st, 2012

The Collection interface is used to pass around collections of objects where maximum generality is desired.It is one of the root interfaces of the Java collection classes.It provides support for the implementation of an unordered collection of objects that may contain duplicates.

What is the relationship between clipping and repainting

Asked By: Interview Candidate | Asked On: Aug 26th, 2004

When a window is repainted by the awt painting thread, it sets the clipping regions tothe area of thewindow that requires repainting.

Answered by: Sandhya.Kishan on: Jul 31st, 2012

Clipping regions are set to the repinted window on the area that requires repainting.When a window is repainted by the AWT painting thread, it sets the clipping regions tothe area of the window that requires repainting.

Q: why are Java archive (jar) files important?

Asked By: Interview Candidate | Asked On: Aug 27th, 2004

Jar files bundle .Class files and optimize applet downloads.

Answered by: Sandhya.Kishan on: Jul 30th, 2012

Jar files are important as it contains the class, image, and sound files for a Java application or applet gathered into a single file and possibly compressed. When a programmer gets a Java program dev...

First | Prev | | Next | Last Page

 

 

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.