There are certain very serious bugs in Java 7 compiler which at last can result in JVM crash. Read the below story on Java World for details..
Java World: Apache and Oracle warn of serious Java 7 compiler bugs
Through this blog, I share my experiences, Problems that me and my team faced and how we resolved them.
Apart from that Technical tips, tricks, Java Basics and also questions that are asked in interviews related to Java.
Now blog can be accessed from a direct URL www.java-espresso.in
Thursday, August 4, 2011
Serious Bugs in Java 7
Labels:
Java,
java 7,
java 7 bugs,
java news,
java7,
oracle java 7,
oracle java 7 bugs
Location:
Bengaluru, Karnataka, India
Thursday, July 7, 2011
Java interview questions:PART1
Q:1. Why would you use a synchronized block vs. synchronized method?
Ans. Synchronized blocks place locks for shorter periods than synchronized methods.
Q:2. How can you force garbage collection?
Ans. You cannot force garbage collection. You can only request by calling System.gc(), Still JVM does not guarantee that GC will start immediately.
Q:3. Can you write a Java class that could be used both as an applet as well as an application?
Ans. Yes. Add a main() method to the applet.
Q:4. Explain "Shallow Copy" and "Deep Copy" in java?
Ans. Both terms are related to object cloning in Java. Follow the following link. It nicely explains this concept Shallow and Deep copy
Q:5. What's the difference between J2SDK 1.5 and J2SDK 5.0?
Ans. No difference, Sun just re-branded this version
Q:6. You want to do an indexed based search on a list of objects. Which of the two Java collections should you choose to store objects: ArrayList or LinkedList?
Ans. ArrayList as LinkedList is good when you always need sequential search.
Q:7. There are two classes: Me and You. The class You need to inform the class Me when some important event has happened. What Java technique would you use to implement it?
Ans. If these classes are threads you can use wait and notify() mechanism. For normal classes make use of Observer interface
Q:8.Can an inner class, declared inside a method, access local variables of this method?
Ans. Only if variables are final (means they are constants).
Q:9. Can we declare main method as final?
Ans. Yes
Q:10. What is the protocol used by RMI?
Ans. RMI-IIOP ( Remote Method Invocation over Internet Inter-Orb Protocol). This protocol delivers CORBA (Common Object Request Broker Architecture)distributed computing capabilities to the Java platform.
Q:11. List some marker interfaces.
Ans. Examples are java.lang.Cloneable, java.io.Serializable and java.util.EventListener
Q:12. What is the algo used in Thread Scheduling in Java?
Ans. Fixed Priority Scheduling
Q:13. Explain the different types of class loaders?
Ans. Below is the Hierarchy of class loaders:
Ans. Synchronized blocks place locks for shorter periods than synchronized methods.
Q:2. How can you force garbage collection?
Ans. You cannot force garbage collection. You can only request by calling System.gc(), Still JVM does not guarantee that GC will start immediately.
Q:3. Can you write a Java class that could be used both as an applet as well as an application?
Ans. Yes. Add a main() method to the applet.
Q:4. Explain "Shallow Copy" and "Deep Copy" in java?
Ans. Both terms are related to object cloning in Java. Follow the following link. It nicely explains this concept Shallow and Deep copy
Q:5. What's the difference between J2SDK 1.5 and J2SDK 5.0?
Ans. No difference, Sun just re-branded this version
Q:6. You want to do an indexed based search on a list of objects. Which of the two Java collections should you choose to store objects: ArrayList or LinkedList?
Ans. ArrayList as LinkedList is good when you always need sequential search.
Q:7. There are two classes: Me and You. The class You need to inform the class Me when some important event has happened. What Java technique would you use to implement it?
Ans. If these classes are threads you can use wait and notify() mechanism. For normal classes make use of Observer interface
Q:8.Can an inner class, declared inside a method, access local variables of this method?
Ans. Only if variables are final (means they are constants).
Q:9. Can we declare main method as final?
Ans. Yes
Q:10. What is the protocol used by RMI?
Ans. RMI-IIOP ( Remote Method Invocation over Internet Inter-Orb Protocol). This protocol delivers CORBA (Common Object Request Broker Architecture)distributed computing capabilities to the Java platform.
Q:11. List some marker interfaces.
Ans. Examples are java.lang.Cloneable, java.io.Serializable and java.util.EventListener
Q:12. What is the algo used in Thread Scheduling in Java?
Ans. Fixed Priority Scheduling
Q:13. Explain the different types of class loaders?
Ans. Below is the Hierarchy of class loaders:
| Class Hierarchy | Description |
| java.lang.ClassLoader | It is root (abstract) class for all the class loaders |
| java.security.SecureClassLoader | This is a concrete implementation of ClassLoader class.This class extends ClassLoader with additional support for defining classes with an associated code source and permissions which are retrieved by the system policy by default. |
| ↑ (extends) | |
| java.net.URLClassLoader | This class loader is used to load classes and resources from a search path of URLs referring to both JAR files and directories. |
| ↑ (extends | |
| sun.applet.AppletClassLoader | This class defines the class loader for loading applet classes and resources. It extends URLClassLoader to search the applet code base for the class or resource after checking any loaded JAR files. |
Subscribe to:
Posts (Atom)