Archive for Java Basic Interview Questions & Answers

You are browsing the archives of Java Basic Interview Questions & Answers.

Java-Fundamental concepts through OOPS

Q) OOPS concepts Polymorphism Ability to take more than one form, In java we achieve this using Method Overloading (compile time polymorphism), Method overriding (runtime polymorphism) Inheritance Is the process by which one object acquires the properties of another object. Encapsulation Wrapping of data and function into a single unit called encapsulation. Ex:- all java […]

Java questions with one word answers

Q: What if the main method is declared as private? A: The program compiles properly but at runtime it will give “Main method not public.” message. Q: What if the static modifier is removed from the signature of the main method? A: Program compiles. But at runtime throws an error “NoSuchMethodError”. Q: What if I […]

Java- Technical question on Networking Concepts

1) The API doesn’t list any constructors for InetAddress- How do I create an InetAddress instance? ANSWER : In case of InetAddress the three methods getLocalHost, getByName, getByAllName can be used to create instances. E.g. InetAddress add1; InetAddress add2; try{ add1 = InetAddress.getByName(“java.sun.com”); add2 = InetAddress.getByName(“199.22.22.22”); }catch(UnknownHostException e){} 2) Is it possible to get the […]

Java-Programitical questions, logical questions,technical questions part-II

This paper gives an idea about Java programmatic questions and logicals that are being asked in interviews for freshers and experienced people. And also don’t forget to read another part of this series here, also check out complete Java section if you want to be master in Java Examine the following class definition: public class […]

Java-Programitical questions, logical questions,technical questions part-I

This paper gives an idea about java coding questions for freshers which are helpful for interview exams… What class must an inner class extend: 1) The top level class 2) The Object class 3) Any class or interface 4) It must extend an interface Answer 3 In the following code, which is the earliest statement, […]

Java- Technicl questions on AWT: CONTROLS, LAYOUT MANAGERS AND MENUS

What is meant by Controls and what are different types of controls? Ans : Controls are componenets that allow a user to interact with your application.The AWT supports the following types of controls: Labels Push buttons Check boxes Choice lists Lists Scroll bars Text components These controls are subclasses of Component. You want to construct […]

Java-Technical questions on EVENT HANDLING

The event delegation model, introduced in release 1.1 of the JDK, is fully compatible with the event model. True False Ans : b. A component subclass that has executed enableEvents( ) to enable processing of a certain kind of event cannot also use an adapter as a listener for the same kind of event. True […]

Java- J2ee interview questions part-II

101. What is form-based authentication An authentication mechanism in which a Web container provides an application-specific form for logging in. This form of authentication uses Base64 encoding and can expose user names and passwords unless all connections are over SSL. 102. What is general entity An entity that is referenced as part of an XML […]

Java- j2ee interview questions

1.What is J2EE? J2EE is an environment for developing and deploying enterprise applications. The J2EE platform consists of a set of services, application programming interfaces (APIs), and protocols that provide the functionality for developing multitiered, web-based applications. 2. What is the J2EE module? A J2EE module consists of one or more J2EE components for the […]

Java- 60 fundamental questions

1.what is a transient variable? A transient variable is a variable that may not be serialized. 2.which containers use a border Layout as their default layout? The window, Frame and Dialog classes use a border layout as their default layout. 3.Why do threads block on I/O? Threads block on i/o (that is enters the waiting […]