masijade 1,351 Industrious Poster Team Colleague Featured Poster

I am working in Netbeans IDE. I cannot type in output window.

Look at the project properties. There is a way to either "hard code" arguments or to get it to pop up a dialog asking for them.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I guess i have to give a command line argument.

As already siad here.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because i is defined within the loop and the condition of the lopp is, technically, outside the loop. A variable only "exists" within the scope in which it is created, in this case only inside the loop and not outside.

Edit: Do note, however, that a variable created outside the loop is visible within because the loop is contained within the scope in which the variable was created.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I'm sorry, but judging by those constructors and some of the other things from those posts it doesn't look like you "know Java". Who knows, maybe you were just "having a bad hair day", but people can only make assumptions from what they've been shown.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

All of which the first hit on the google search would have told you (and much more) had you bothered to look. All I'm asking for is some visible effort on your part.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, no. I've given you hint, at least give it a try. How are you going to learn anything if I just give you the answer.

Like I said, give a try (a real try) and then post that code and we will help you to correct it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No. You can use the "length" together with a for loop and combination of two calls to substring with each iteration.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well then, let's see how much you have learned using Google. Without thinking of any specific language, what is collision detection and how might it be used in this situation? Where you have a moving object that you don't want to cross certain areas?

IOW, I have told you what it is you need to use to accomplish this feat, and even pointed you to resources to learn something about it, and you don't seem to want to do that. It seems to me as though you want "teh codez". Well, you are not going to get them here.

Designate coordinates that should not be crossed then use collision detection to determine when your "moving" object has reached them. The principle is simple, now start studying.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

See the jdbc tutorials paying attention to the preparedstatement portion.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
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

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

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

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

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

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

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

Because you have mangled your url. See the tutorials.

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.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, you've declared name and color to be static. What does static mean?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Then just stick with the first line.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Write it to another file, delete the old and rename the new to the old.

In this "special" circumstance you actually could overwrite the five characters
[pre]"#how"[/pre] with [pre]"how "[/pre] (note the extra space) using RandomAccessFile, but that is not, of course, the same as "deleting" the "#".

File are simply sequential bytes on the disk. The only way to "delete" a character from that is to shift all the bytes behind it forward, and the only way to do that is to read and rewrite them. Since you are talking about a single character, and not a block of at least 4k, all of those read and write calls to the disk would be extremely ineffecient. It is simply easier, and much more effecient, and the standard, accepted practice to simply read it and write a new file and replace the old with the new. When the files are guaranteed to be small, you can always read them in completely, modify that in memory, and then write out to the same filename (note, that, technically, this still creates a new file, though, simply overwriting the old filesystem reference directly).

Just so you know, even all of these mainstream file editors do this. They do not, because they can not (effeciently), "modify" the file "in place".

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You are not sure what is? Your not sure what that does, at all? or your not sure why it doesn't do what it is suppossed to?

Or is it that it "doesn't work" because you still have

private void tempTextFieldActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
}

in your code?

This "(5 / 9)" is integer math and so will return "1". Is that what you want? No. You need to use at least one double in that part, either "5.0" or "9.0" (or both).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because Component is an awt element not a swing element. Cast to JComponent.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, you need to study threading, in general, much more, before continuing here as this stuff is so far off-track that I can't even decipher what it was you were attempting.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

First of all "run" should not be synchronized. And, if you synch on "lock", you should also "wait" on "lock", not "this". See the tutorials (and API docs).

http://download.oracle.com/javase/6/docs/

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And your problem is?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

After calling setIcon, call validate and/or repaint on the component (or, even better, on the container that contains the component).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

IOW "do my (home)work for me". No.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What do you think the 2,3,4 and 10,11,12 are? Especially when combined with the description from the first post? And why do you still have a for loop there? Where is there a for loop shown in the pseudocode? IOW, those "do something" blocks need only be the buffer.append stuff (and a break, of course) and all that other bs you can get rid of.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Lets see your implementation of that while/switch.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Just simply do a

//pseudo code
while(readline)
  switch(++count)
    case 2:
    case 3:
    case 4:
        do something and break
    case 10:
    case 11:
    case 12:
        do something break
    default:
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Make one up and then use the ftype and assoc commands to create the associations (on windows, on Linux you probably need to use the "control panel"). Google those commands.

Edit: And, if you wish to "deploy" that association, then make sure whatever "installer" maker you have can handle the registry changes (on windows and the equivalent on *nix).