masijade 1,351 Industrious Poster Team Colleague Featured Poster

Of course not with that query. Where did "Rollno" go? What about the advice about PreparedStatement? Posting the complete stacktrace would help as well.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, what is the definition of regd_no? Figure that out and implement a solution for its value (I wouldn't doubt that its nothing but a one-up index number). As far as "how to get it from the frame", how are you "getting the other data"?

My God. You don't seem to even want to try. Well, I can tell you right now, this is probably my last post in this thread until you actually do something.

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

Read this completely and thoroughly, and implement its suggestions.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

how can i create a application that will compute fot the net income of a particular employee

By typing in a text editor. We are not a homework service.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

So start a new thread as this is a completely different question. P.S. that advice about StringTokenizer is not worth listening to. StringTokenizer has big problems with non-ASCII character sets among other limitations and drawbacks. It is effectively deprecated.

Killing this 4 year dead zombie now.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

By inserting them. I don't know where the problem is you insert both cubeData[j][coo] & stChange[j] rather than updating with one and matching with the other. Where is the problem?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

If the method in which the exception may occur is capable of handling that exception, then you catch it, otherwise you throw it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What "border lines". And, if you have a "scrollbar", then you should probably be attempting to change the border on the JScrollPane. And try setting the border to an "EmptyBorder" and not null.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

So then use an insert and not an update. Jeez. Learn SQL. And do not cobble together statements like that unless want an SQL Injection attack or spurious invalid SQL errors.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Creating a new table is completely contradictory to the purpose of a relational db.

As far as doing it, if you insist and we all know you will, and will come up with all sorts of reasons as to why it has to be that way, you use a Statement to execute a create table, then use a Statement (or PreparedStatement if there is "configurable" parameters) to set off an insert ... select statement. If you do not know how to do a "create table" or an "insert ... select" then find an SQL (not any kind of Java) forum.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

In most languages that might be good advice, but it is a bit unnecessary in Java. In Java using = in an if statement (except in special circumstances and never as the "boolean" operator) will cause a compile error that you must fix before the program will compile, so it is not quite as "important" (or maybe "relevant" is a better word) in Java.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Please, do not attempt to teach "newbies" the ternary operator, and please, also, do not teach them not to use braces ({}) in an if statement (or for/while loops, etc). It is always safer to use braces and both of these things will do nothing but confuse "newbies" at this point.

Just an attempt at constructive criticism.

P.S. The "value" to check (whether year or y) will, of course, depend on how the rest of the code is written. Now, whether or not those used names correspond to the implied names in the assignment description is another matter.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

If "year" is the value to check then that, of course, is the value you need to use in the if statement. In any case, the second version is the one to use, as long as you are checking the right value and actually check for 2012, not 2010.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Have you looked at the API docs for Integer yet?

Shouldn't you be saving the result (i.e. the user input) from that input dialog?

Shouldn't you be using that user input in the print statement?

Aren't you suppossed to print only the question at the indicated index (not two questions)?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Sure. Show us what you have we'll guide you in writing the rest.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, the array creation, yes, that works. Displaying a specific index also works (although you should be using user intput for that index).

What's missing. of course, is the user input (and the use of that input in the prints).

I don't understand why you've called the class "apples", though.

Edit: And what is with that extra pair of braces after the last print?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, in this case, no, simply use that integer to index into the array.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
String[] strings = { "a", "b" };

Then see the API docs for Scanner (as this seems to be the preferred method for most instructors, although it is not my personal choice) and Integer.parseInt(String) (although with Scanner this part is not necessary).

System.out.println(strings[index]);
masijade 1,351 Industrious Poster Team Colleague Featured Poster

I've tried this -->

/* This is from the application piece */
JFrame myframe = new JFrame("My Frame");
myframe.addWindowListener(new WindowAdapter() {
     public void windowClosing(WindowEvent e) {
        Runtime.getRuntime().exit(0);
     }
  });

Don't use addWindowListener (you can but it's not current and not suggested for "standard" activities). Rather then that use the line suggested earlier.

/* This is from the action event of the button */
JButton close = new JButton("Close");
close.addActionListener(new ActionListener() {
     public void actionPerformed(ActionEvent e) {
        myframe.dispatchEvent(new WindowEvent(close,WINDOW_CLOSING);
     }
  });

This part is good. You can either continue to use it as is, or change the dispatchEvent line to a combination of setVisible(false) and dispose.

Seriously, just to close a Frame? It's ridiculous..

No it's not, it's generic. Regardless of what action you want to take the action is coded the same way. In fact, by using the WindowListener version above you can then have the program take some specific actions before closing such as flushing streams, closing varying types of connections, etc, etc. It is, however, better to have those actions (if you are going to do it in that manner) is a shutdownHook and simply call exit (as above).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No. That message says you are getting to the DB but that the DB is denying access.


Network problems would be something else, as would mistyped urls. You have either the wrong user, wrong pass, wrong db, or wrong grants.

gunjannigam commented: Thanks for current and fast help +2
masijade 1,351 Industrious Poster Team Colleague Featured Poster

As far as I know, if the instance of JFrame is a, the code for registering its closing button could be one line of code as follows:

a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

No, that line of code describes what should happen when the frame closes. It does not close the frame.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, what is your idea of a "fair amount of code"? Why don't you show us what it is you've tried?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I don't know too much about this PHP thing, but since PHP normally runs on a website, and that website can possibly be in the same place as the db, you have a different dynamic there. Now, all I can tell you is that this message is exactly what you get when the grants are not correct.

Then again, the message says database "db" and your code shows that the database should be "data". Recheck that as well (which would give the same error message since you will not have granted any access to the database "db").

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Read the MySQL manual. The user administration portion. Pay close attention to the portion about Grants.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Easily, but I don't wish to say how.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Why should I help either pirate someone elses stuff (although with an applet, if you know anything about them, you can get the compiled code easily enough) or help you cheat on some assignment?

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

Use a JList and not a JTextArea

masijade 1,351 Industrious Poster Team Colleague Featured Poster

If there is an embedded JVM (which do exist) and you are using Java RealTime (which sounds like an oxymoron, but it exists and is real time, although I don't know if it is applicable to the embedded market), which isn't free, BTW (a pretty hefty license, to tell the truth, if I rememeber right).

As you can guess from this post, this is not the sort of thing Java was meant for.

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

Hi
Thank you masijade, it worked. But then in which cases will I have to use mypackage.HelloWorld.java?

You won't. You'll use

java -cp . mypackage.HelloWorld

when you execute.

because as I was reading I heard that I can compile the sourcefiles regardless of been in a certain directory, I heard of something like classpath setting which gave me a bit of confussion.

That "-cp" is the "classpath thing you've heard of and has to do with where the classes are not where the source files are.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Wow, a whole 5 years in all of that? Didn't leave a whole lot of time to specialise in anything, did it? You really think you're qualified to train people? Tutor, yeah. Hold classes (judging only from this post, of course), I think not.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

mypackage/HelloWorld.java

performed from

/home/user/workspace

masijade 1,351 Industrious Poster Team Colleague Featured Poster

how do I start making database in using access database using java?

please help me....

Thank you...

Closing this 5 year dead zombie. See the tutorials

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I'm sticking with this because you do seem to be trying

I agree, he is and I commend both of you. I just think that he could really benefit from "hands-on" help as he seems to be having a really hard time of it on the forum.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Like I said, find someone locally who can sit beside you as you don't seem to be able to digest what we're telling you here. You've been told about split (and other things) more than a few times (for weeks now) and you still can't seem to get it right. Not that I know why you included the braces ({}) in your text file, but hey.

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

Note that your loop is starting at 2, so you are only getting 11 months. Change the initial setting in your loop to start at 1 instead.

That's because the code was written to ask for, and read, the first value before entering the loop.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And if those tutorials advocate widespread use of scriptlets they are absolutely worthless. Advocating practices that lead to unscaleable and nearly unmaintainable code is not acceptable.

Edit: Not to mention that this thread is two years dead. Killing this zombie now.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

To each his own. You need to start using methods and the such though, and this was a good opportunity to try it out.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Either change the "Choice1" method to void and remove lines 23 and 33 (above), or change "Choice1" so that it does not take any argument, change line 23 (above) to include the Type declaration, and "combine" lines 10 and 12 (above).

All the line numbers in this post refer to the client class.

By redefining the passed in array in "Choice1", you lose the reference to the original method that was passed in, and by not reassigning the result of the method back to the original bookInfo reference when calling Choice1, you are left with an "empty" array.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

That code is reading twelve values and printing the (number of the) month corresponding to the highest value. What else do you want? Maybe you should see the comment about the static import. If you want the highest temp and not the month containing it, then simply print the other value.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay? And your question is? (Assuming "in" is a static import of System.in)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

JDialog with a JLabel containing an Icon.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

More buzzwords with less meaning in a shorter phrase I have never seen.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Change those classes to use JPanels rather than JFrames.

Edit: Better (although you probably wouldn't comprehend it, yet) is to extend JComponent and override any method that you dont wan't to be able to have effect your component.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

element + element ?

It might help to have a better explanation of the problem along with the code you've already tried and the error/compile messages (complete messages/stacktraces) that it produces.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Put that code into a different method (not main) that accepts an integer as a paramter (and change i<2*i+1 to i<2*parameter+1) and then call that method from main with 10000, 20000, etc (which can be figured in a for loop from 1 to 10 multiplying this number by 10000).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, let's see what you've tried.