Java interview questions and answers for freshers and experienced
Java features
Simple, Object-Oriented, Robust, Distributed, Portable, Interpreted, Multithreaded, Platform Independent, Secure...........Read answer
Java program execution
What is JVM? Explain its roles and functions.Explain why Java is called as Platform independent language. Explain how Java executable executes on any platform where JVM is available...................
Read answer
Java architecture
Java programming language, Java class file format, Java Application Programming Interface, Java virtual machine.............Read answer
Java class
Explain the features of Java class. Explain Fields, Methods, and Access Levels.What are accessors and mutator methods in a Java class? Explain with example for each.
Explain the importance of 'this' reference. Write a code to depicts the use of 'this' reference
Explain static variables and static methods in Java. Provide an example to explain them..................
Read answer
Java constructors
What is a constructor? Explain the differences between methods and constructor.Differences between constructors and methods.
Write code to depict the use of constructor.....................
Read answer
Java class member
What is instance members? Explain with an exampleWhat is instance variable? Explain with an example
What is instance method? Explain with an example
What is static member? Explain with an example
What is static variable? Explain with an example......................
Read answer
Java packages
What are Java packages? Explain the importance of Java packages.Steps for creating a package in Java
Explain the packages access specifier, i.e. private, protected, public, default.............
Read answer
Java garbage collector
Explain Java Garbage collector. Why garbage collection? Brief explanation of Garbage collection algorithms.Explain the importance of finalizers in Java. Write code to depict the uses of finalizers in Java...............
Read answer
Java super keyword
Explain the importance of 'super' keyword in Java. Write code to depict the uses of 'super' keyword - The keyword ‘super’ is used for referring parent class instance....................Read answer
Java overloading & overriding
Define Method overloading. Explain its uses. Provide a code sample to explain the uses of Method overloadingDefine Method overriding. Explain its uses. Provide a code sample to explain the uses of Method overloading
Difference between overloading and overriding.......................
Read answer
Java string class
Describe Java string class. Explain methods of Java string class. Explain the characteristics of StringBuffer class - String Class: The String class is immutable, The contents of the String object can not be changed, String class is final class. That implies it can not have sub classes......................Read answer
Java inner classes
What is Java inner class? Explain the types of inner classes, i.e. Static member classes, Member classes, Local classes, Anonymous classesNeed of inner class in context with adapter classes
Explain few Wrapper Classes Methods...............
Read answer
Java reflection class
Explain about Java reflection class.Write a code sample to depict the uses of Java reflection class.........
Read answer
Java swing
What is Swing? Explain the need of Swing.Write some important features of Swing.
Describe Java Swing class hierarchy.
Explain the need of Layout manager...........
Read answer
Java layout manager
Explain different layout manager in Java. - A layout manager organizes the objects in a container, Different layouts are used to organize or to arrange objects.............Read answer
Java exception handling
Explain the need of Exception handling.Explain the Exceptions categories, i.e. checked and unchecked exceptions.
Provide the general form of Exception handling constructs with explanation
What is user defined Exception? Explain with an example............
Read answer
Java multithreading
What is Multithreading? Explain the life cycle of a thread.Explain how to use thread class for Multithreading in Java. Explain with an example.
What is Runnable interface? Explain how to use Runnable interface for Multithreading.
What are the methods of thread class in java? Explain them
Can your explain thread priorities?..............
Read answer
Java file handling
Explain the use of Streams.Difference between Stream classes and Reader writer classes
Explain and demonstrate the use of File, RandomAccessFile classes.
Explain the use of Reader and Writer classes..............
Read answer
Java utility classes
What is object Serialization? Explain the use of Persisting object.Depict the step of using object Deserialization.....................
Read answer
Java socket programming
What is socket? Explain the features of socket.Explain the characteristics of Java socket class.
Explain ServerSocket class with an example
Explain InetAddress class with an example
Explain DatagramSocket class with an example
Explain DatagramPacket class with an example.............
Read answer
JDBC
Purposes of JDBC APIDescribe 4 types of JDBC drivers and their characteristics with usages.
State the functionalities of important classes in JDBC packages.
Explain how to use JDBC statement to execute SQL queries. Show in an example
Explain how to use Prepared Statement to execute parameterized queries. Show in an example
What is JDBC Callable Statement?
What is batch updates in JDBC? Explain with an example......................
Read answer
Write your comment - Share Knowledge and Experience
|
Java interview questions and answers - April 18, 2011
What is an abstract method?
An abstract method is a method which doesn’t have a body, just declared with modifier abstract.Explain the use of the finally block.
Finally block is a block which always executes. The block executes even when an exception is occurred. The block won't execute only when the user calls System.exit()What is the initial state of a thread?
It is in a ready state.What is time slicing?
In time slicing, the task continues its execution for a predefined period of time and reenters the pool of ready tasks.What are Wrapper Classes?
Wrapper Classes allow to access primitives as objects.What is List interface?
List is an ordered collection of objects.Can you explain transient variables in java?
They are the variables that cannot be serialized.What is synchronization?
Synchronization ensures only one thread to access a shared resource, thus controls the access of multiple threads to shared resources.What is serialization?
Serialization helps to convert the state of an object into a byte stream.What is HashMap and Map?
Map is Interface and Hashmap is class that implements that.Java interview questions and answers - April 20, 2011
What is StringBuffer class?
StringBuffer class is same as String class with the exception that it is mutable. It allows change and doesn’t create a new instance on change of value.How can you force garbage collection?
It is not possible to force GC. We can just request it by calling System.gc().Is it possible an exception to be rethrown?
Yes, an exception can be rethrown.What is the return type of a program’s main() method?
A program’s main() method has a void return type.Which package is always imported by default?
The java.lang package is always imported by default.What is a Class?
A class implements the behavior of member objects by describing all the attributes of objects and the methods.What is an Object?
An object is the members of a class. It is the basic unit of a system. It has attributes, behavior and identity.Explain the use of "instanceOf" keyword.
"instanceOf" keyword is used to check the type of object.How do you refer to a current instance of object?
You can refer the current instance of object using "this" keyword.What is the use of JAVAP tool?
JAVAP is used to disassemble compiled Java files. This option is useful when original source code is not available.In which package is the applet class located?
Applet classes are located in "java.applet" package.Java array vs. ArrayList class.
ArrayList is a dynamic array that can grow depending on demand whereas Java arrays are fixed length.Explain Enumeration Interface.
It defines the methods using which we can enumerate the elements in a collection of objects.What are access modifiers?
Access modifiers determine if a method or a data variable can be accessed by another method in another class.Explain the impact of private constructor.
Private constructor prevents a class from being explicitly instantiated by callers.What is an exception?
An exception is an abnormal condition that arises in a code sequence at run timeJava interview questions and answers - April 21, 2011
What are ways to create threads?
There are two ways to create a thread:extend the java.lang.Thread class
implement the java.lang.Runnable interface
How can we stop a thread programmatically?
thread.stop;What are daemon threads?
Daemon threads are designed to run in background. An example of such thread is garbage collector thread.What are the different types of locks in JDBC?
There are four types of major locks in JDBC:Exclusive locks
Shared locks
Read locks
Update locks
What are Servlets?
Servlets are program that run under web server environments.What are the different ways to maintain state between requests?
There are four different ways:URL rewriting
Cookies
Hidden fields
Sessions
No comments:
Post a Comment