Originally posted by Michael Imhof:
I thought, a labelled break is working like a "goto". So after calling
"break lab" it breaks the loop and returns to the label.
Originally posted by anindam bhattacharaya:
G'day
I have a problem getting to understand this code.
I am failing to understand why is this printing
"hello" only twice.
( tags added)
[ November 29, 2004: Message edited by: Barry Gaunt ]
in the 1st iteration, i=0,j=0 and i+j not > than 10. print hello
in the 2nd iteration, i=0,j=1 and i+j not > than 10. print hello
in the 3rd iteration, i=0,j=2 and i+j not > than 10. print hello
etc.
Originally posted by JayaSiji Gopal:
public class Test {
static int total = 10;
public static void main (String args []) {
new Test();
}
public Test () {
System.out.println("In test");
System.out.println(this);
int temp = this.total;
if (temp > 5) {
System.out.println(temp);
}}}
The compiler reports an error at line 2
The class will not compile
The value 10 is one of the elements printed to the standard output
The compiler reports an error at line 9
The class compiles but generates a runtime error
i answered the 4th option,but the correct answer is 3.
i answered 4th, bcos static variables cannot have a this reference.
plz correct me, wht is wrong?
Originally posted by siva kumar:
What are the differences bw RequestProcessor and ActionServlet.
The advantages of RequestProcessor over ActionServlet.
Originally posted by manish ahuja:
What I intended to ask from my post was Cant we have caching without resorting to Singleton
Say I use the caching part of the code mentioned in the original post in Scenario1 & force it on scenario2.
Wont I be able to still use caching
In short do we have to have singleton to enable caching or I can have caching even without being a Singleton class
Originally posted by manish ahuja:
Hi All
I was going through Sun BluePrints where they show 2 types of service locators
quoting from the blue prints
***************************************
The Java Pet Store sample application, v1.3.1 has two service locators: a Web-tier class ServiceLocator , and an Enterprise JavaBeansTM (EJB) tier class, also called ServiceLocator . Both classes manage lookup and caching of enterprise bean home interfaces, JMS and database connection factories, and environment entries within their respective tiers. The only difference between them is that the Web-tier class is a singleton, and it caches the objects it looks up. The EJB-tier class is not a singleton, and does not cache.
****************************************
Here are the links to the code piece
1) the 1 that looks up as well as caches
http://java.sun.com/blueprints/code/jps131/src/com/sun/j2ee/blueprints/servicelocator/web/ServiceLocator.java.html
This is synchronized. My question is does it have to be that way. In the above code for caching was Singleton necessary
2) the 2nd one looks up but does not cache and is neither a Singleton
http://java.sun.com/blueprints/code/jps131/src/com/sun/j2ee/blueprints/servicelocator/ejb/ServiceLocator.java.html
Do post your viewpoints on the same
Rgrds
Manish