Help coderanch get a
new server
by contributing to the fundraiser

Joni Salonen

Ranch Hand
+ Follow
since Jan 07, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Joni Salonen

The expression "new Test().go()" is a method invocation expression of type "primary . identifier ( )" as you can read from
http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.12

"Primary" can be any primary expression but in this case it's a "ClassInstanceCreationExpression" of the type "new ClassOrInterfaceType ( )". See
http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.8
http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.9

Edit: Note that operator precedence doesn't affect how the program text is parsed
[ October 22, 2006: Message edited by: Joni Salonen ]
17 years ago
Coming from C/C++? In Java an array is an object that has a property called lenght; it is not a simple block of memory. Therefore the issue with passing arrays as arguments to methods and not knowing how many elements they contain doesn't exist in Java.

> The reference I have says I can declare this:

Sounds like your reference is not very reliable; what you quote is utterly false.

In Java the brackets that declare an array can go behind both the type and the varible, so "String[][] btns[][]" declares a four-dimensional array of Strings. I think you meant to write "String[][] btns" which would be only two-dimensional.

[ October 01, 2006: Message edited by: Joni Salonen ]
[ October 01, 2006: Message edited by: Joni Salonen ]
17 years ago
I suggest looking into the javax.olfaction package. It's included in the standard in the upcoming release of Java 8.
17 years ago
The replace(char,char) method is easy to use.Note that the parameters are single characters, not strings.
17 years ago

Originally posted by Jean-Francois Briere:
[QB]Generics and arrays don't mix well. This is one of the zillion problems with generics.



Actually, I think it's rather a problem with arrays; as you probably know, their type safety has been broken since day 1.
A better solution to the problem would be ditching the array and using some List implementation. If it suits your needs, of course.
17 years ago
What do you use for GUI? In swing, Arabic and Greek should work out-of-the-box, without changing any settings. The default font which comes with Sun's runtime environment has glyphs for them. If the data you retrieve from the DB is fine there won't be any problems with displaying it. So, like Paul said, if you have problems displaying, it means that the problem is likely with how you retrieve data from the database, rather than with the rendering process.
17 years ago
If by "console" you mean the infamously incapable "MS DOS prompt" on Windows, I would be surprised if it could show arabic and greek letters. If you want text to be shown correctly, reliably and platform independently, it's best to use a graphical user interface.
[ September 21, 2006: Message edited by: Joni Salonen ]
17 years ago
What are the elements of the array?

If they are integers, you can simply XOR all of them together.
17 years ago
Suppose the compiler let you do that and that you now have a List of Numbers in list1. Now lets say you want to add a Number to the list, let's say.... new Double(338.67). There's no one stopping you, so congratulations, you now have put a Double in a List that was originally supposed to consist of Integers.

You can fix the compiler error by using "? extends Number" instead of "Number" but remember that you still can't add anything to the list.
Why would you write a method of your own when the standard API provides us with lexicographic comparators?

There's String.CASE_INSENSITIVE_ORDER for, well, case-insensitive order, and java.text.Collator for true alphabetic order (e.g. in English a < � < b).
[ May 06, 2006: Message edited by: Joni Salonen ]
18 years ago
Java uses Unicode for everything, so if your program works with english text there is no reason why it shouldn't work with arabic text.
18 years ago
The first site is made using Macromedia Flash. Has nothing to do with Java. See http://en.wikipedia.org/wiki/Macromedia_Flash

The second site uses a web application implemented with Java Server Pages. See http://en.wikipedia.org/wiki/Java_Server_Pages
18 years ago
The rule is: choose the most specific signature possible.

As String is a subbclass of Object, the amethod(String) method has the most specific signature, so it is chosen.

Edit: If there is no method with the most specific signature, like when you add amethod(Number n), you get a compile-time error.
[ March 14, 2006: Message edited by: Joni Salonen ]
18 years ago
readUnsignedByte, like all other methods specified by the DataInput interface, throws an EOFException if the end of the stream was reached. The method read doesn't throw an exception but returns -1. Both are required in DataInputStream because it is an InputStream that implements the DataInput interface (and thus must have both methods).
18 years ago
The input file should look like it was written by ObjectOutputStream.

Please read this tutorial:
http://java.sun.com/docs/books/tutorial/essential/io/serialization.html
18 years ago