Posts

Showing posts with the label java

J2EE Interview Questions&Answers

Image
What is J2EE?  J2EE Stands for Java 2 Enterprise Edition. J2EE is an environment for developing and deploying enterprise applications. J2EE specification is defined by Sun Microsystems Inc. The J2EE platform is one of the best platform for the development and deployment of enterprise applications. The J2EE platform is consists of a set of services, application programming interfaces (APIs), and protocols, which provides the functionality necessary for developing multi-tiered, web-based applications. What do you understand by a J2EE module? A J2EE module is a software unit that consists of one or more J2EE components of the same container type along with one deployment descriptor of that type. J2EE specification defines four types of modules: a) EJB b) Web c) application client and d) resource adapter In the J2EE applications modules can be deployed as stand-alone units. Modules can also be assembled into J2EE applications. Tell me something about J2EE compon...

JAVA Interview Questions&Answers Part 3

Image
What is the purpose of the finally clause of a try-catch-finally statement? The finally clause is used to provide the capability to execute code no matter whether or not an exception is thrown or caught. What is the Locale class? The Locale class is used to tailor program output to the conventions of a particular geographic, political, or cultural region. What must a class do to implement an interface? It must provide all of the methods in the interface and identify the interface in its implements clause. What is an abstract method? An abstract method is a method whose implementation is deferred to a subclass. Or, a method that has no implementation (an interface of a method). What is a static method? A static method is a method that belongs to the class rather than any object of the class and doesn't apply to an object or even require that any objects of the class have been instantiated. What is a protected method? A protected method is a method that can be accessed by any me...

JAVA Interview Questions&Answers Part 2

Image
What are synchronized methods and synchronized statements? Synchronized methods are methods that are used to control access to an object. A thread only executes a synchronized method after it has acquired the lock for the method's object or class. Synchronized statements are similar to synchronized methods. A synchronized statement can only be executed after a thread has acquired the lock for the object or class referenced in the synchronized statement. What are three ways in which a thread can enter the waiting state? A thread can enter the waiting state by invoking its sleep() method, by blocking on I/O, by unsuccessfully attempting to acquire an object's lock, or by invoking an object's wait() method. It can also enter the waiting state by invoking its (deprecated) suspend() method. Can a lock be acquired on a class? Yes, a lock can be acquired on a class. This lock is acquired on the class's Class object. What's new with the stop(), suspend() and resume() m...

JAVA Interview Questions&Answers Part 1

Image
Can a private method of a superclass be declared within a subclass? Sure. A private field or method or inner class belongs to its declared class and hides from its subclasses. There is no way for private stuff to have a runtime overloading or overriding (polymorphism) features. Why Java does not support multiple inheritence ? Java DOES support multiple inheritance via interface implementation. What is the difference between final, finally and finalize? o final - declare constant o finally - handles exception o finalize - helps in garbage collection Where and how can you use a private constructor. Private constructor can be used if you do not want any other class to instanstiate the object , the instantiation is done from a static public method, this method is used when dealing with the factory method pattern when the designer wants only one controller (fatory method ) to create the object. In System.out.println(),what is System,out and println,pls explain? System is a predefined f...

Core Java Interview Questions&Answers

Image
What is transient variable? Transient variable can't be serialize. For example if a variable is declared as transient in a Serializable class and the class is written to an ObjectStream, the value of the variable can't be written to the stream instead when the class is retrieved from the ObjectStream the value of the variable becomes null. Name the containers which uses Border Layout as their default layout? Containers which uses Border Layout as their default are: window, Frame and Dialog classes. What do you understand by Synchronization? Synchronization is a process of controlling the access of shared resources by the multiple threads in such a manner that only one thread can access one resource at a time. In non synchronized multithreaded application, it is possible for one thread to modify a shared object while another thread is in the process of using or updating the object's value. Synchronization prevents such type of data corruption. E.g. Synchronizing a funct...