masijade 1,351 Industrious Poster Team Colleague Featured Poster

Yes, testing (on a different but equivalent database) until the code is correct.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What happens if n is 0 (or 1 for that matter)?

P.S. that's a hint/clue.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You are missing a library.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

It's called "collision detection".

Zabzacon commented: Very unhelpful +0
masijade 1,351 Industrious Poster Team Colleague Featured Poster

A MouseListener?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Of course its possible. Anythings possible. It is not reliable, though.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well now, that's more like it. See those brackets "[" "]"? Those are not legal sql. That is MS stuff.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Again, this cannot be the code you are executing. Where in the SQL statements you are using does a "[" appear? As, the error that is appearing is indicating that there is a "[" in the SQL that it tried to execute.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

This is not the code you're running considering the message

syntax error at or near "["

Edit: Not that you should be using scriptlets at all. And also most definately not be loading the driver and getting a new connection with every page load, use a pool.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Is this the same reason for all the Java stuff? And, if you are preparing for an "interview", don't you find it a bit late to be learning that for which you have applied? Common sense says you should have some idea about what it is you're applying for before you apply for it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Yes (on windows). That, however, is a system question.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

As for this: "If anybody knows anyother simple way to design a thread tell me." Are you asking about threads now? If you dont know how to do 2D arrays, leave threads for annother day.

Well, investigate the posting history.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

It is the "path" on which "class"es will be searched for by the jvm/compiler.

Edit: And don't do this on the system environment CLASSPATH variable. I know I have told you this already, if running from a web container/app server place jars in the META-INF/lib directory (usually), if running/compiling from an IDE add the jars as references/libraries in the project properties/preferences for that project, if running from the command line using the -jar option then properly define the classpath attribute in the manifest file, if running/compiling from the command without the -jar option then use the -cp option.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

as long as it is taking place in the main method it is creating a reference to a file using a name provided on the command line (the first argument after the classname in the java command).

masijade 1,351 Industrious Poster Team Colleague Featured Poster
class Bogus implements Runnable {
    String action;
    Bogus(String action) {
        this.action = action;
    }
    public void run() {
        if (action = "whatever") {
            // do something
        } else .... {
            // do something else
        }
    }
}

At this point you are not ready for threading.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

See this response.

Now it is no longer a warning.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster

See this response.

And you are now getting an infraction warning.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Sure. Will we give it to you, no. We are here to help you correct your code, we are not here to do your (home)work for you. If that is all you are looking for go here.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Using different text (and different formating) depending on the language and/or region.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You can't. As I have told you here, simply assign some instance variable in the constructor and have the run method do different things based on the value of that/those variables.

The only other way is to write three different classes.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Use the method getResource which will return a URL to the loaded properties file so that you can use that url to both load and later store the properties.

Edit: Assuming, of course, that the URL returned is a "file:" url, if not you will not be able to store them back into the original location, so your program should check that to.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

By only defining it once?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Nope, not unusual at all, especially considering the trailing comma.

Don't use <= in the for loop as the "length" is one larger than the last used index and the number at that (length) index will be 0 (if it does not result in an indexoutofboundsexception will it will if all of the numbers are even, odd, or negative.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Neither. The only language that could be called "purely" OO (although there is no "official" definition of the term) is SmallTalk.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And what did I say? The "run" method shjould not be defined inside the constructor, of course. And you need have only one constructor. Otherwise three constructors with a signature of the class name and no arguments will also not work, as I've already said. A constructor is essentially a method and two methods can have the same name only when their parameter list varies (by type).

Edit: This reply was "overlapped" by the previous reply. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Do you have any clue as to what it is you are doing? Or are you just groping around in the dark hoping to find the door before falling down the stairs?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Bacause you have the same constructor signature three times. Like I said, use one constructor that simply sets an instance variable or two. Then, whether implemented or extended you still need to define a run method in the class definition (not inside the constructor, of course) and that run method can do different things depending on the values of those instance variables.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

In other words, you create an instance for each possible response (and the class should implement runnable rather than extending thread) and then, when the user enters a choice you create a thread using that Runnable from the array and start it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, maybe with something like

public MyStackThread(int userChoice) {
    //assign some instance value
}

That is, of course, just the start.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You still haven't created an actual constructor for your class, and you should, of course, be creating an instance of your class in each of the elements, not just an instance of Thread, of course. That code I posted was just an example and is in no way, shape, or form, cut-n-paste compatible with yours.

And use code tags.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Post your "new" code.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

See ,I am using object array to invoke start() method . If i create individual threads using new i cant use object array like threadobj[j].

Yes you can

public class Bogus1 {
	public static void main(String[] args) {
		Thread[] t = new Thread[5];
		for (int i = 0; i < t.length; i++) {
			final int value = i;
			t[i] = new Thread(
				new Runnable() {
					public void run() {
				    	try {
				    		Thread.sleep(5);
				    		int j = 0;
				    		while (j++ < 1000000) {
				    			System.out.println(value);
				    			Thread.sleep(1);
				    		}
				    	} catch (InterruptedException ie) {}
					}
				});
			t[i].start();
		}
	}
}

that two lines object creation and invoking start() method shows no error.Error is only in the class MyStackThreads. Same error class, interface or enum expected at 28,30,33

That is not showing an error because "syntactically" it is correct (i.e. those methods exist for that type), but by execution it would result in a NullPointerException.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You would "create individual threads" by actually calling "new" for each of the elements in the array in your StackThread class.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well !! I've executed the program after replacing the codes that i told you to and did get a proper output. Just paste the changed code again , i'll look through it.

And simply pasting a "solution" does not help the OP. Suggest a change or post a small snippet (wihtout using the OPs exact variables) and let the OP struggle through it so that they actually learn something. They learn nothing when someone else does it for them. Not to mention that it is against the policy of this site to do that.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Another thing to look at is to read the documentation for the libraries you're using and see if they intern strings, and if so what strings. If the strings they intern are things that will constantly be changing in your program then you are going to want to not load those libraries on the application classloader, but rather to create a classloader where those are used and unload that classloader after they have been used (which will then remove those interned strings). This will affect your performance some (not as much as you might think unless you are sending many thousands of mails per minute), but it will also preserve your permgen space.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Show your new code, it looks like you are multiplying the last number by ten (or maybe just adding a zero to the end through some other manner). P.S. I would also suggest not using "2.0" in your modulo statement, just use 2, otherwise you are making that a double operation and it just might not work properly.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Try increasing your permgen space. (Google that and see your server documentation as to where to make the change.)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, this MyStackThreads[j] is not a constructor.

A constructor looks like

public ClassName(ParamType param) {
  // do something to "initialise" the class
}
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay? So what is your problem?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, it might help to see that part of your code.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You can see how many by inspecting the int return of the executeUpdate which tells you how many were affected. If you want to tell which ones, you are going to have to make a copy and compare, realising that other changes may have taken place between these actions.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

That * catches both files on the same command, so it assumes you are trying to move both files to a directory. You will have to handle them one at a time (i.e. without the * ).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay. Closing.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Yes, I could have said that, but by finding that little thing yourself, you now know it well enough that you will either never again make that mistake, or will know to check for it if you do.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because you have mangled your url. See the tutorials.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Go back to my first post and read the rest of it (after the first line).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

If it is a text file, BufferedReader, if it is not explicity a text file BufferedInputStream, like always for reading files. For "removing" the "#", the replace method of String, for writing the file BufferedWriter or BufferedOutputStream using the same consideration, respectfully, as used for Reader/InputStream. Now at least try to write something.

newcoder310 commented: Crystal clear +1
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Conn is null, obviously.