-
-
-
-
-
-
-
-
-
-
//Note:before installing Tomcat the code gave no error:Pls give me suggestion">
I get the following error while running a servlet that connects with database.Required:java.sql.Connectionfound:ConnectionThe line is Connection con = DriverManager.getConnection("here the oracle datasource ","user",password");//Note:before installing Tomcat the code gave no error:Pls give me suggestion
-
-
-
-
-
-
-
ob.a++;
try{
Thread.sleep(1000);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
}
class C extends Thread
{
C()
{
start();
}
public void run()
{
for(int i=0;i<2;i++)
{
System.out.println("ValueC:"+ob.a);
ob.a++;
try{
Thread.sleep(1000);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
}
B t1=new B();
C t2=new C();
}
}
">Anybody can explain how it is going to work and why it works soclass A{ int a; A() { a=20; }}class Myth{public static void main(String S[]){final A ob=new A(); class B extends Thread { B() { start(); } public void run() { for(int i=0;i
-
-
Garbage collection (object lifetime)
Explain details of concept of"object iceland" in garbage collection (object lifetime) in core java
-
fs.write (blk, 0, blk.length);
fs.close();
During writing a file I want use encoding like ISO-8859-1. I can't use Writer because my contents are byte stream. Same way I can't use BufferedOutputStream or DataOutputStream because its not supporting encoding. How do I solve this. Please help me. ">I have a file whose contents are written in french. I want to read that file and edit the file and then write the contents back to the same file. How do I do that?I am reading file content is instanceof ByteBlock only. Then I am using byte[] blk = ((ByteBlock) content).bytes();FileOutputStream fs = new FileOutputStream("a.txt");fs.write (blk, 0, blk.length);fs.close();During writing a file I want use encoding like ISO-8859-1. I can't use Writer because my contents are byte stream. Same way I can't use BufferedOutputStream or DataOutputStream because its not supporting encoding. How do I solve this. Please help me.
Java Interview Questions
Ans