JAVA Interview Preparation Questions Part 1

on 1:37 AM

Are you a developer? Need to update your software development knowledge or need to prepare for a job interview? Check out this collection of Java Interview Questions  (part 1)...
  • What's Java?
  • What does a well-written OO program look like?
  • Can you have virtual functions in Java?
  • Jack developed a program by using a Map container to hold key/value pairs. He wanted to make a change to the map. He decided to make a clone of the map in order to save the original data on side. What do you think of it? ?

  • What is more advisable to create a thread, by implementing a Runnable interface or by extending Thread class?
  • What is NullPointerException and how to handle it?
  • An application needs to load a library before it starts to run, how to code??
  • How could Java classes direct program messages to the system console, but error messages, say to a file?
  • What's the difference between an interface and an abstract class?
  • Name the containers which uses Border Layout as their default layout?
  • What do you understand by Synchronization?
  • What is Collection API?
  • Is Iterator a Class or Interface? What is its use?
  • What is similarities/difference between an Abstract class and Interface?
  • How to define an Abstract class?
  • How to define an Interface?
  • If a class is located in a package, what do you need to change in the OS environment to be able to use it?
  • How many methods in the Serializable interface?
  • How many methods in the Externalizable interface?
  • What is the difference between Serializalble and Externalizable interface?
  • What is a transient variable?
  • Which containers use a border layout as their default layout?
  • How are Observer and Observable used?
  • What is synchronization and why is it important?
  • What are synchronized methods and synchronized statements?
  • What are three ways in which a thread can enter the waiting state?
  • Can a lock be acquired on a class?
  • What's new with the stop(), suspend() and resume() methods in JDK 1.2?
  • What is the preferred size of a component?
  • What's the difference between J2SDK 1.5 and J2SDK 5.0?
  • What would you use to compare two String variables - the operator == or the method equals()?
  • What is thread?
  • What is multi-threading?
  • How does multi-threading take place on a computer with a single CPU?
  • How to create a thread in a program?
  • Can Java object be locked down for exclusive use by a given thread?
  • Can each Java object keep track of all the threads that want to exclusively access to it?
  • Does it matter in what order catch statements for FileNotFoundException and IOExceptipon are written?
  • What invokes a thread's run() method?
  • What is the purpose of the wait(), notify(), and notifyAll() methods?
  • What are the high-level thread states?
  • What is the difference between yielding and sleeping?
  • What happens when a thread cannot acquire a lock on an object?
  • What is the difference between Process and Thread?
  • Can an inner class declared inside of a method access local variables of this method?
  • What can go wrong if you replace &emp;&emp; with &emp; in the following code: String a=null; if (a!=null && a.length()>10) {...}
  • What is the Vector class?
  • What modifiers may be used with an inner class that is a member of an outer class?
  • If a method is declared as protected, where may the method be accessed?
  • What is an Iterator interface?
  • How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters?
  • What's the main difference between a Vector and an ArrayList?
  • What are wrapped classes?
  • Does garbage collection guarantee that a program will not run out of memory?
  • What is the difference between preemptive scheduling and time slicing?
  • Name Component subclasses that support painting?
  • What is a native method?
  • How can you write a loop indefinitely?
  • Can an anonymous class be declared as implementing an interface and extending a class?
  • What is the purpose of finalization?
  • When should the method invokeLater()be used?
  • How many methods in Object class?
  • How does Java handle integer overflows and underflows?
  • What is the numeric promotion?
  • Is the numeric promotion available in other plantform?
  • What is the difference between the Boolean & operator and the && operator?
  • When is the ArithmeticException throwQuestion: What is the GregorianCalendar class?
  • What is the SimpleTimeZone class?
  • How can a subclass call a method or a constructor defined in a superclass?
  • What is the Properties class?
  • What is the purpose of the Runtime class?
  • What is the purpose of the System class?
  • What is the purpose of the finally clause of a try-catch-finally statement?
  • What is the Locale class?
  • What is an abstract method?
  • What is the difference between interface and abstract class?
  • What is a static method?
  • What is a protected method?
  • What is the difference between a static and a non-static inner class?
  • What is an object's lock and which object's have locks?
  • When can an object reference be cast to an interface reference?
  • What is the difference between a Window and a Frame?
  • What is the difference between a Window and a Frame?
  • Which package has light weight components?
  • What are peerless components?
  • What is the difference between the Font and FontMetrics classes?
  • What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?
  • What classes of exceptions may be caught by a catch clause?
  • What is the difference between throw and throws keywords?
  • If a class is declared without any access modifiers, where may the class be accessed?
  • What is the Map interface?
  • Does a class inherit the constructors of its superclass?
  • Name primitive Java types.
  • Which class should you use to obtain design information about an object?
  • How can a GUI component handle its own events?
  • How are the elements of a GridBagLayout organized?
  • What advantage do Java's layout managers provide over traditional windowing systems?
  • What are the problems faced by Java programmers who don't use layout managers?
  • What is the difference between static and non-static variables?
  • What is the difference between the paint() and repaint() methods?
  • What is the purpose of the File class?
  • Why would you use a synchronized block vs. synchronized method?
  • What restrictions are placed on method overriding?
  • What is casting?
  • Explain the usage of the keyword transient?
  • What class allows you to read objects directly from a stream?
  • How are this() and super() used with constructors?
  • How is it possible for two String objects with identical values not to be equal under the == operator? How are this() and super() used with constructors?
  • What is an IO filter?
  • What is the Set interface?
  • How can you force garbage collection?
  • What is the purpose of the enableEvents() method?
  • What is the difference between the File and RandomAccessFile classes?
  • What interface must an object implement before it can be written to a stream as an object?
  • What is the ResourceBundle class?
  • How do you know if an explicit object casting is needed?
  • What is a Java package and how is it used?
  • What are the Object and Class classes used for?
  • What is Serialization and deserialization?
  • Explain the usage of Java packages.
  • Does the code in finally block get executed if there is an exception and a return statement in a catch block?
  • How do you restrict a user to cut and paste from the html page?
  • Is Java a super set of JavaScript?
  • What is a Container in a GUI?
  • How the object oriented approach helps us keep complexity of software development under control?
  • What is polymorphism?
  • What is design by contract?
  • What are use cases?
  • What is scalability and performance?
  • What is the benefit of subclass?
  • How to add menushortcut to menu item?
  • Where and how can you use a private constuctor.
  • In System.out.println(),what is System,out and println,pls explain?
  • Can you write a Java class that could be used both as an applet as well as an application?
  • Can you make an instance of an abstract class? For example - java.util.Calender is an abstract class with a method getInstance() which returns an instance of the Calender class.
  • What is the output of x > y? a:b = p*q when x=1,y=2,p=3,q=4?
  • What is the difference between Swing and AWT components?
  • Why Java does not support pointers?
  • Parsers? DOM vs SAX parser
  • Can you declare a class as private?
  • What is the difference between shallow copy and deep copy?
  • Can one create a method which gets a String and modifies it?
  • Why is multiple inheritance not possible in Java?
  • What's the difference between constructors and other methods?
  • What is the relationship between synchronized and volatile keyword?
  • This class (IncrementImpl) will be used by various threads concurrently; can you see the inherent flaw(s)? How would you improve it?
  • What are the drawbacks of inheritance?
  • Is there any other way that you can achieve inheritance in Java?
  • Two methods have key words static synchronized and synchronized separately. What is the difference between them?
  • How do you create a read-only collection?
  • Can a private method of a superclass be declared within a subclass?
  • Why Java does not support multiple inheritance ?
  • What is the difference between final, finally and finalize?
  • What kind of security tools are available in J2SE 5.0?
  • How to make an array copy from System?
  • Can we use System.arraycopy() method to copy the same array?
  • What is shallow copy or shallow clone in array cloning?
  • When is the ArrayStoreException thrown?
  • How to check two arrays to see if contents have the same types and contain the same elements?
  • Can you call one constructor from another if a class has multiple constructors?
  • What are the different types of inner classes?
  • In which case would you choose a static inner class?
  • What is the differnce between final, finally and finalize?
  • What is weak reference in Java
  • What's the difference between the methods sleep() and wait()
  • The following statement prints true or false, why?
  • Why do we need to use getSystemResource() and getSystemResources() method to load resources?
  • ArithmeticException?
  • What is a transient variable?
  • Which containers use a border Layout as their default layout?
  • Why do threads block on I/O?
  • Wha is the output from System.out.println("Hello"+null);?
  • What is synchronization and why is it important?
  • Can a lock be acquired on a class?
  • What's new with the stop(), suspend() and resume() methods in JDK 1.2??
  • Is null a keyword?
  • What is the preferred size of a component?
  • What method is used to specify a container's layout?
  • Which containers use a FlowLayout as their default layout?
  • What state does a thread enter when it terminates its processing?
  • What is the Collections API?
  • which characters may be used as the second character of an identifier, but not as the first character of an identifier?
  • What is the List interface?
  • How does Java handle integer overflows and underflows?
  • What is the Vector class?
  • What modifiers may be used with an inner class that is a member of an outer class?
  • What is an Iterator interface?
  • What is the difference between the >> and >>> operators?
  • Which method of the Component class is used to set the position and size of a component?
  • How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters?
  • What is the difference between yielding and sleeping?

2 comments:

mary Brown said...
This comment has been removed by the author.
mary Brown said...

Great Article
Online Java Training | Java Training in Chennai | Java Training Institutes in Chennai | Java EE course | Java Course in Chennai | J2EE Training in Chennai | java j2ee training institutes in chennai | Java 360

Post a Comment