Forum: Java 2 Days Ago |
| Replies: 3 Views: 156 > Why use abstract classes at all? Why not just declare a class and
> then make sure you never instantiate any variables of that type?
...because compile time checks are far superior/efficient... |
Forum: Java 12 Days Ago |
| Replies: 6 Views: 320 > So what I need to know to be Java expert in Web and Desktop
> Applications?
Apart from the points already mentioned, I'd like to stress on reading good books/code. I've seen people churn out... |
Forum: Java 17 Days Ago |
| Replies: 2 Views: 253 NumberFormat is an abstract class; use its static factory method to get your choice of number formatter.public class MainTest {
public static void main(String args[]) throws Exception {
... |
Forum: Java 19 Days Ago |
| Replies: 2 Views: 377 The commas and the brackets are a part of the ArrayList class's toString() implementation. If you need your own row representation, either write your own method which does so or better yet, create a... |
Forum: Java 32 Days Ago |
| Replies: 16 Views: 903 Sadly, this simple a thing becomes pretty clunky to implement when it comes to Java. A sample implementation might be something like:
class YourClass {
private static final List<String>... |
Forum: Java Oct 21st, 2009 |
| Replies: 6 Views: 362 > Thank you - my understanding of generic types is still somewhat limited.
When in doubt, always look at the standard library code which comes prepackaged with the JDK. For e.g. in this case,... |
Forum: Java Oct 2nd, 2009 |
| Replies: 2 Views: 337 JNI would be too low level; try something like SWIG (http://www.swig.org/)or JNA (https://jna.dev.java.net/). |
Forum: Java Sep 21st, 2009 |
| Replies: 10 Views: 1,114 Your second file is missing the class imports. I don't see the declaration of your `Convert' enum class. Your naming conventions are still off.
These are pretty simple error messages to hunt down... |
Forum: Java Sep 21st, 2009 |
| Replies: 10 Views: 1,114 A few observations:
- Always perform resource cleanup in the `finally' block to be rest assured that the cleanup indeed is performed even if the code ends up throwing an exception.
- The way you... |
Forum: Java Sep 20th, 2009 |
| Replies: 10 Views: 1,114 >Thanks a lot guys for the help!
Good luck with the remaining exercises.
> I will flag this as solved when I get my account fixed.
Done and done. :-) |
Forum: Java Sep 20th, 2009 |
| Replies: 10 Views: 1,114 Read the contract of the substring method; substring(4, 6) == 2 characters.
Also get in the habit of using uppercase characters for enums i.e. `BIN' instead of `bin'. |
Forum: Java Jul 4th, 2009 |
| Replies: 4 Views: 408 > but it seems to work with a "real" file system on a "client side".
I'm not really sure what you mean by a `real' file system; the File class provides an `abstract filesystem independent view' of... |
Forum: Java Jun 9th, 2009 |
| Replies: 3 Views: 210 Look into the batch execution capabilities (http://java.sun.com/j2se/1.3/docs/guide/jdbc/spec2/jdbc2.1.frame6.html) of JDBC. |
Forum: Java May 4th, 2009 |
| Replies: 7 Views: 275 > I was wondering why do we need constructors with arguments?
Creation of an object based on an existing one [though this can be done the `Cloneable' way, constructor based approach is also... |
Forum: Java Apr 26th, 2009 |
| Replies: 2 Views: 385 > Why should I do this(in bold)? :
Because we require the hex equivalent a generated byte and not the integer this byte gets up-casted to. When converting to hex string, we would want our... |
Forum: Java Apr 24th, 2009 |
| Replies: 4 Views: 1,462 When do you think the compile time error 'symbol not found comes up'? What does your text book say about such errors? The example you posted seems a pretty bold one for someone who has just started... |
Forum: Java Feb 17th, 2009 |
| Replies: 2 Views: 600 NaN (http://en.wikipedia.org/wiki/NaN). Read the section on "How NaN is created", step through your code a single method at a time and it should be pretty easy. Use a debugger; a slick one which... |
Forum: Java Jan 27th, 2009 |
| Replies: 17 Views: 1,230 > nobody here expects every poster's English to be without flaws,
> but since English is not my 2nd or 3rd language (4th, actually)
Just because you can do it doesn't mean everyone can; each... |
Forum: Java Jan 26th, 2009 |
| Replies: 17 Views: 1,230 > to prove my stance being correct here
Let me say this once again; the stance of posting sarcastic/hostile comments is never the correct one. Normally hostile attitude adopted towards a forum... |
Forum: Java Jan 24th, 2009 |
| Replies: 3 Views: 727 > but when I start the client nothing happens
Put a few debugging statements to monitor the entire conversation and post where exactly your program hangs. For e.g. print out a debugging statement... |
Forum: Java Jan 23rd, 2009 |
| Replies: 11 Views: 2,930 IMO Scanner is much more than just another I/O class with a pretty interface/API; it has advanced parsing capabilities which attempts to remove the utility class most programmers create to process... |
Forum: Java Jan 18th, 2009 |
| Replies: 20 Views: 903 > Where 'this' as mentioned above refers to the current object. Since
> static members do not belong to any particular object/instance as
> such, for them 'this' does not make any sense.
... |
Forum: Java Jan 14th, 2009 |
| Replies: 20 Views: 2,326 > i just thought you guys would of liked a challenge lol
I have got enough challenges in my daily life, I guess I'll just pass. :-)
But don't give up hope, who knows, masijade might just end up... |
Forum: Java Jan 14th, 2009 |
| Replies: 18 Views: 1,774 > int generator1 = generator.nextInt(20)+1/2;
Operator precedence anyone?
> /*
> * To change this template, choose Tools | Templates
> * and open the template in the editor.
> */
I am... |
Forum: Java Jan 14th, 2009 |
| Replies: 2 Views: 359 Though I don't do standalone application development using Swing, a few obvious comments.
> Class.forName("com.mysql.jdbc.Driver").newInstance();.
You don't need to do this for every... |
Forum: Java Jan 9th, 2009 |
| Replies: 11 Views: 704 *Ahem*, time to bring this thing on topic.
> i have to submit project in java....next month.....
> please help me.....
As per the rules laid down... |
Forum: Java Dec 31st, 2008 |
| Replies: 7 Views: 1,476 > every serializable class needs a static final long "serialVersionUID"
> field
Yes, but static fields as a rule are not serialized by default. serialVersionUID is a special static field which is... |
Forum: Java Dec 26th, 2008 |
| Replies: 3 Views: 597 > one byte of storage for each character
Why is it that you are required to come up with such a hack just to extract some data? Where is the data coming from? Doesn't every field have some... |
Forum: Java Dec 25th, 2008 |
| Replies: 4 Views: 2,149 You ain't doing it right. Maybe this (http://www.serc.iisc.ernet.in/~amohanty/SE288/ieee754.html)would help. |
Forum: Java Dec 22nd, 2008 |
| Replies: 8 Views: 1,544 Saying that 'XXX is not possible in Java' is pretty misleading IMO.
Is I/O and Networking possible in Java? You might say yes, there are packages like java.io.* and java.net.* for it. But is it... |
Forum: Java Dec 19th, 2008 |
| Replies: 5 Views: 672 > He stated that both methods are bad programming practices.
No, it isn't; don't fall into such debates as anyone who tries to convince you such is just selling snake oil. If it really were that... |
Forum: Java Dec 12th, 2008 |
| Replies: 8 Views: 735 If you plan on viewing the output on Eclipses's console, it shouldn't be that big a problem. Try following the advice in this ... |
Forum: Java Dec 9th, 2008 |
| Replies: 10 Views: 1,243 > But, sometimes, I just don't feel like taking the effort to try
> talking them out of it.
Yes, even I get that sort of feeling but seeing that VernonDozier is a Daniweb regular, I took my... |
Forum: Java Dec 9th, 2008 |
| Replies: 10 Views: 1,243 In Java, everything is passed by value; in case of primitive types, a copy of the value is created and then passed as an argument to the method invoked.
private void mutateItNot(int v) {
v = 10;... |
Forum: Java Nov 26th, 2008 |
| Replies: 25 Views: 1,548 It's not about being thankful; as long as someone benefits/learns something from the answers posted, it's always an effort worth spent. I have very little time and lot of boards to manage so most of... |
Forum: Java Nov 26th, 2008 |
| Replies: 25 Views: 1,548 > but i do get the feeling that i am being a bother, if you don't
> wanna help me, fine
If you would have bothered to read the all replies given to your post, you would have noticed that it... |
Forum: Java Nov 14th, 2008 |
| Replies: 28 Views: 1,737 It would be difficult to explain the real use of reflection without throwing in a lot of terminology. Maybe reading this (http://martinfowler.com/articles/injection.html)article will help you... |
Forum: Java Nov 11th, 2008 |
| Replies: 8 Views: 570 Making IOException and SQLException as checked exceptions is regarded as one of the blunders of the Java standard library design. Many might argue that having checked exceptions in itself is a big... |
Forum: Java Oct 27th, 2008 |
| Replies: 7 Views: 592 >The problem is, I am not the author of the original and as such have not clue as to what
> methods the classes have and in which class.
Then how do you propose on adding additional... |
Forum: Java Oct 26th, 2008 |
| Replies: 3 Views: 633 Post a compilable piece of code; what you posted isn't even remotely a valid Java program.
In Java, multi-dimensional arrays are represented as array of array. This allows you to ignore the second... |