masijade 1,351 Industrious Poster Team Colleague Featured Poster

cross-posted and all because someone can't use five minutes to read the API docs, but will spend days waiting on someone else to read it for him.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You will have to ask the designers of the language because it was their conscious decision not to include. Most people assume it was to avoid the problems that C++ currently has with Diamond inheritance. P.S. Java does have multiple inheritance of Type (you can include as many interfaces as you wish), just not multiple inheritance of implementation (you can only directly extend one Class).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because there is no parseString method in String. Simply assign the provided String to the new variable. The API docs are your friend, BTW. Ask them first.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Then the first line is a blank line (or there are no lines, but then it would print null) and you are only reading one line. Also, if you can't work with the Sun tutorials no other's will help you either. The advice about closing the outer most reader/writer still stands.

Edit: Aack, you also need printStacktrace, not getStacktrace.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Close the bufferedwriter and not the file writer. By closing the filewriter you are probably preventing the bufferedwriter from flushing.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because toString() is called using Objects declaration, in that case, and polymorphism causes Date's toString() method to be used.

You do know that imports have no effect on a compiled class, right? They are not even there anymore. They exist solely in the source files and solely for programmer "convenience", that they can type Date rather than having to type java.util.Date

masijade 1,351 Industrious Poster Team Colleague Featured Poster

A "marker" interface is an interface with no methods and no variables and simply used to "mark" a Class. I don't think an example should be necessary.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, they just anounced they are not going to do it anymore. BTW, other's can make a jvm for Apple, Apple just is not providing the information necessary to make it. We'll have to see how much that changes since they are not going to do it anymore, and who they are going to give it to (if anyone).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No, that is not "putting it on the classpath". Do not put anything into the jre/jdk directories. If executing/compiling from the command line (without the -jar option) use the -cp option, if running from the command line with the -jar option, correctly configure the manifest file and place the jar in the proper place relative to the application jar, if using a web container/app server place the jar in the proper place (i.e. normally WEB-INF/lib for web containers but for drivers possibly a shared/lib somewhere in the server libs), and if using an IDE then add the jar as a library to the projects properties/preferences. See the tools documentation for the java/javac commands, the Manifest File tutorial, the web container/app server documentation, and the IDE documentation for more details on the chosen path.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

By opening a text editor?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

See the API docs for SimpleDateFormat and attempt to define as many formats as possible and attempt to parse them with leniency off. Not an easy task, but I don't know of any API that already does it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No, they both create a "Customer" array, and both create one filled with null references. Before you use one of the indexes you need to define it. i.e. in the place where you are doing customers[1].setName you first need to check whether it is defined, and, if not, define it if (customers[1] == null) customers[1] = new Customer(); And then you still need to figure out how to index into the array as I don't think you mean to always use the second element in the array, as that code currently would.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, you want to actually set a value in index 24, right? So it is either <= 24 or < 25 (the same goes for the 49). You also want to set the value at that index so what is the length reference doing there? Also, the last half should be three times the index, right? Not the index Cubed (i.e. to the power of three), right?

Also, the array should consist of 50 elements, not 15 and you use square brackets [ ] not parens ( ) to declare an array length.

Also, you should be printing all 50 values, not just 10. But, you should be using print, not println (and don't forget to include some spacing between the numbers) and just use println at every 10th index (google java modulus).

You also need to declare a class to contain this main method, not just the method, and the main method has a specific signature (I'm sure you've been taught what that is) that you are not adhering to.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because your array contains all null references. When you create an array of Object (regardless of the Object type) all it creates is an array of references, but, until you assign the reference to an actual object to those slots, the slots are filled with null references.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Yep, reading the documentation normally helps with stuff like that.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, should that not be ftp://ipaddress?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay, so lets see what you have. And, if by "help" you mean that we should write (any part of it) for you, then you can forget that now.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No, the "hash" has nothing to do with the reference value. The "hash" is calculated everytime you call the hashCode function and the calculation is based upon the Objects value not its reference.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay? Nobody writes error free programs in a first draft (or even 100th, many times), so what's the problem?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What are you trying to accomplish?

Edit: And no, you cannot print out the reference value (in the normal scheme of things), but trust me, the JVM has access to it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because the hashCode is based on the Strings value not its reference.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Didn't do your midterm project and now looking for one to copy, huh?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No? Which site did you accidentally log into and post this question?

kvprajapati commented: :) +11
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay, lets say your locks are numbered 1 - 5 (looking at your max min loop).

Now, lets say two threads are working, one doing a forward sort and one doing a backword sort. Now, lets say the one doing the forward sort gets a lock on say lock three, and the one doing the backward sort gets a lock on lock four. Now, each of these threads (due to your "stacking" or "embedding" of locks) wants to get the lock on the lock object that the other thread already holds. Boom, deadlock.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

200 is nothing. Parse the xml file into a list, then make a copy of that list to actually random index into (deleting those accessed indexes, of course).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Not in Java, though.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Please at least let people know that you are cross-posting.

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

Well, if your starting it as an application (and not an applet or web service or etc) then yes (assuming the actual "m.End()" method creates and displays the GUI). If the JFrame is being created in the constructor (and "MyClass" extends JFrame) then you should change that. Make "MyClass" extend JPanel (or JComponent) and have the "End" method create and show the JFrame adding "this" to it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay? And that means?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, why don't you tell us what your exact problem is and post a small, self-contained, compilable piece of code that demostrates the problem.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm,

1. You do know that this thread is a 2+ year dead zombie, right? Why did you resurrect it?

2. You do realise that the respone Phalax made was a sarcastic insult on the OPs typing skills, and not a serious suggestion, right?

Closing this thread now.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

As even a newbie should know, if you don't understand something someone tells you, then you need to tell them what it is you didn't understand not just, essentially, repeat the original question. And, when the subject is technical, then even a newbie should know to pick out the key terms and google them rather than just capitulate. As a programmer you will constantly be confronted with things you don't know but will be expected to be able to do them, or at least to figure them out, on your own.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay? And that stops you from posting the exception and searching for the term "PreparedStatement", how?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Is that your message or is that a real exception message?

Also, do not cobble together statements like this. Use a PreparedStatement and its set... methods to include the username and password or you are just asking for problems.

I can't say anything about that "into @name" syntax since I don't recognise it, but MySQL does do some strange things, so who knows.

One thing I do know about MySQL, though, is that if that password field is a "password" field and not just a char/varchar/text field, then MySQL will have digested that password and a digest string will exist in that field, not the actually entered text.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What exception? The full stack trace please.

And don't do

catch(Exception e){
    JOptionPane.showMessageDialog(null,"Error in connectivity");
}

Show the actual exception not some meaningless string.

Edit: Or, at least, not only the meaningless String.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well don't assign the result of Arrays.sort to anything.

A "senior moment"? Arrays.sort sorts the array you pass to it and has return type null. Hence my concern that it changes the actual source data.

Nope, that was in answer to the post before yours concerning the compiler error message the OP was getting. ;-)

The rest of the post was for you though. I probably should have marked those as "@OP" and "@James". ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well don't assign the result of Arrays.sort to anything.

And, yes, it is overkill, but, unless the size of the array is huge, or the step needs to be done a lot in a short period of time, it is easier to just use that then having to start creating your own "utility" methods for doing all these sorts of things (or "reinventing the wheel" everytime you need to do something like it).

Also, I usually have to do this "highest" sort of thing in simulation programs where the "highest" is not what I am searching for, but rather a niveau % index (i.e. say the niveau percent is 97% and the array has 100 elements, then I am searching for the 3rd highest value) where the niveau is paramaterised, as is the size of the array. And for this sort of thing a sort comes in really handy.

Edit: In this case, however, considering it is a histogram, I would also use a loop and the Math.max() method.

int h = Integer.MIN_VALUE;
for (int i : ip.getHistogram()) { h = Math.max(h, i); }
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Where did the sort go?

And what "exception errors"?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Instead of using "this" use an instance of the other class.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Java is an inanimate thing, it has no objective perspective on its future.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

As said a few posts ago ...

Object[] bogusArray = { /* some Objects */ };
Object someElement = bogusArray[bogusArray.length - 1];
masijade 1,351 Industrious Poster Team Colleague Featured Poster

We are not here to do peoples work for them. They learn much better when they actually do it themselves. Besides the fact that our own conduct rules here ask that you not do that.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because Arrays.sort doesn't return anything. It sorts the array. After calling that simply take the last element of the array.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Arrays.sort()

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Nope. static methods are class specific. I.E. They apply to that class and that class only. If a subclass then declares a static method of the same name and parameters as its super class it then "hides" the method from the super class (when accessed through the subclass), but does not override it since the super classes method applies only to the super class and the subclasses method applies only to the subclass.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Edit: Nevermind that.

You use the JOptionPane for each of the numbers, not the sum.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Stick to original thread.

Closing this thread now.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
(\\s+|\\s*<[^>]+>\\s*)
masijade 1,351 Industrious Poster Team Colleague Featured Poster

See the API docs for the Comparator Interface (and google a tutorial or two) and then use the Collections.sort(List<T>, Comparator<T>) method.