-
-
-
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
-
-
Why there is no constructor in Servlet?
Servlet is Java class. Then why there is no constructor in Servlet? Can we write the constructor in Servlet
-
The type of data returned by a method need not be compatible with the return type specified by the method
A) TrueB) FalseExplanation: The type of data returned by a method must be compatible with the return type specified by the method. For example, if the return type of some method is boolean, you could not return an integer
-
Comments in Java Program must begin with /* and end with */
A) TrueB) False