I want to control database connections in my program and want that only one thread should be able to make database connection at a time. How can I implement this logic?


No Answer is Posted For this Question
Be the First to Post Answer

Post New Answer

More Core Java Interview Questions

What is the purpose of assert keyword used in jdk1.4.x?

0 Answers  


How to count occurrences of each duplicate element in a list {a,b,d,c,a,b} ? Thanks in Advance

2 Answers   TCS,


public class Garbage { int a=0; public void add() { int c=10+20; System.out.println(c); System.out.println(a); } public static void main(String args[]) { Garbage obj=new Garbage(); System.gc(); System.out.println("Garbage Collected"); obj.add(); } } Above is a code in java used for garbage collection. object obj has been created for the class Garbage and system.gc method is called. Then using that object add method is called.System.gc method if called the obj should be garbage collected?

6 Answers  


What is a file pointer?

0 Answers  


Can we override the main method?

4 Answers  


How do you use final keywords and final variables in Java?

2 Answers  


Is it compulsory to have atleast one abstract method in abstract class?

10 Answers  


Can an interface be defined inside a class?

0 Answers  


What Is Pointer?

4 Answers  


diff between abstract methods and interfaces with programing (code) example?

2 Answers  


How do I get a substring?

0 Answers  


What is tree node in java?

0 Answers  


Categories