Posts
 
Reputation
Joined
Last Seen
Ranked #209
Strength to Increase Rep
+8
Strength to Decrease Rep
-2
94% Quality Score
Upvotes Received
145
Posts with Upvotes
120
Upvoting Members
62
Downvotes Received
9
Posts with Downvotes
8
Downvoting Members
6
28 Commented Posts
9 Endorsements
Ranked #207
Ranked #236
Member Avatar for tensity

It probably doesn't matter, but storing the suit as a string seems pointlessly wasteful. I might not go so far as to store the rank of the card in a `short` in the name of efficiency, but I would definitely store the suit as an `enum`. Your `getSuit` can convert …

Member Avatar for Hunter_2
0
2K
Member Avatar for Pobunjenik

You should never ever go into an infinite loop in the event dispatch thread. That would cause your whole application to freeze. Look at this if you aren't sure how to use javax.swing.Timer: http://docs.oracle.com/javase/7/docs/api/javax/swing/Timer.html I think you want `new Timer(500, listener)`. I put 500 instead of 100 because you said …

Member Avatar for sishenyelang
0
1K
Member Avatar for dwel

I have watched about 0.1% of this series, but it seems like it could be good: [Derek Banas Java Video Tutorial](http://www.youtube.com/playlist?list=PLE7E8B7F4856C9B19) There is also this site where they expect you to buy a subscription, but what I have seen of their videos hasn't shown me where the money goes. You …

Member Avatar for Rajeev Kumar_1
0
469
Member Avatar for bguild

I've noticed that there are various icons around the site that aren't appearing for me in Firefox the way they appear in Internet Explorer. They seem to be characters without the font needed to render them. I have attached a screenshot that shows the effect, most obviously next to the …

Member Avatar for Dani
1
875
Member Avatar for darylglenng

`System.out.print((k>=10)?+k:" "+k)` is just a complicated way of writing `System.out.printf("%2d",k)`.

Member Avatar for pallav89
0
639
Member Avatar for matthewwhite011

> Some day in the future man will evolve without brains due to lack of use. It's not just a joke. It might actually happen. We evolved our brains thanks to the survival of the fittest in prehistoric times when we needed a large amount of cleverness just to get …

Member Avatar for Reverend Jim
0
958
Member Avatar for happygeek

Nothing on the internet should ever be trusted totally. Just as operating systems should be designed with the assumption that each piece of software may be the enemy, games should be designed with the assumption that each player may be the enemy. The most important element of ensuring players have …

Member Avatar for mrgreen
1
505
Member Avatar for kevinyu

I did some experimenting because I am a little rusty at Android java, but I managed to get something like what you want working. I think your big mistake is accessing the Internet from the UI thread. I'm surprised that doesn't cause an exception for you because my Android emulator …

Member Avatar for kevinyu
0
234
Member Avatar for bumsfeld

There are some interesting design choices in Nimrod. I read the tutorial and it not only explained how to use the language; it also sometimes mentioned reasons for some of the features and many of those reasons are about efficiency. The compiler requires forward declarations because looking ahead would slow …

Member Avatar for rubberman
1
324
Member Avatar for gagun

I'm certainly not an expert, but it looks like you are calling `findViewById` before it is ready. You should probably avoid calling it until after you have called `setContentView` in `onCreate`. From the documentation for `findViewById`: "Finds a view that was identified by the id attribute from the XML that …

Member Avatar for cool_zephyr
0
875
Member Avatar for jemz

Drawing is normally done in the `paint` method using the `Graphics` that you are given. You cannot create a `Graphics` using `new Graphics()` because that is forbidden. It is possible to draw outside of the `paint` method, but those are advanced techniques that you probably don't need because they are …

Member Avatar for jemz
0
1K
Member Avatar for Pobunjenik

Just looking at the code I believe I see several problems. On line 48 I suspect you are demonstrating one of the major problems with copy-and-paste code. I think you really want that line to say `if(locationJ.toArray()[j] == positionJ)`. You should prefer using a private method instead of copying your …

Member Avatar for JamesCherrill
0
2K
Member Avatar for godzab

> When I try to remove a number, it removes the whole right side. That is what you should expect when you do `temp.setNext(null)` because nulling the link of `temp` makes `temp` the end of the list. If you want to remove just one element then you need to get …

Member Avatar for godzab
0
234
Member Avatar for asif49

> I have been told that when entering the US, customs officials can insist that you reveal the password for an engrypted file or partition. And if you refuse... > you'd just be detained even longer and probably end up with a terrorism charge just to get you to cooperate. …

Member Avatar for jwenting
0
748
Member Avatar for bibiki

> the instance of the builder is passed to Builder.build(this) method That sounds like you are passing an instance of `Builder` to a static method of `Builder`, which seems very unlikely. I can think of two answers to your question. My favorite is that objects that never change are easier …

Member Avatar for bibiki
1
155
Member Avatar for CoilFyzx

`javax.swing.JTable` is a class with many features and complexities, but I am sure that it can't do what you are asking for directly. I recommend that you use ordinary `javax.swing.JLabel`s for your top column headings and then use two `JTable`s, one for "Subjects" and one for "Group Letters". That won't …

Member Avatar for JamesCherrill
0
910
Member Avatar for Violet_82

You normally don't have access to the instance variables of an object. If you want encapsulation, you need to make your fields `private`, and that means you can't call `printf` with the instance variables from anywhere outside of the class. On the other hand, it is good practice to make …

Member Avatar for Violet_82
1
224
Member Avatar for ceelos1974

The answers to your questions seem to reach all the way down to the fundamentals of Java programming. If you would show us your failed attempts to make these things happen we could probably easily explain why your attempts were failing, but otherwise the only answers that I can think …

Member Avatar for ceelos1974
0
225
Member Avatar for peymankop

It sounds like you want `javax.swing.JFileChooser`. You can learn all about how to use it in this tutorial: http://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html And in the javadox: http://docs.oracle.com/javase/6/docs/api/javax/swing/JFileChooser.html

Member Avatar for bguild
0
128
Member Avatar for overwraith

There is a big difference between a field and a local variable. You must not treat them lightly. When you say `JButton team1` on line 28 you are creating a local variable called `team1` and every time you use the name `team1` in the method after that you are using …

Member Avatar for overwraith
0
173
Member Avatar for maxcatozzi

You are ignoring whatever error messages you might be getting. There are many kinds of `java.io.IOException`, and each one will at least include a stack trace that will tell you exactly which line of your source code is causing the exception. The `IOException`s may even include a helpful error message …

Member Avatar for stultuske
0
1K
Member Avatar for parkz16

A field and a local variable that happen to have the same name are otherwise completely unconnected. Only the name is the same. It is much like having a method and a local variable with the same name. As far as the compiler is concerned, it is just a trivial …

Member Avatar for bguild
0
33K
Member Avatar for riahc3

while ( user.length() == 0 ){ System.out.println("Please insert a valid member"); } > This is the correct way to do validation in a production application. I don't know why it got voted down, but as a user of a production application I would find that sort of validation highly unpleasant. …

Member Avatar for peter_budo
4
873
Member Avatar for DarkLightning7

On line 31 you are creating a new array for the reference `n`. On line 32, you are testing if `n` is contained in `closedSet`. Since the `n` array never existed before that moment, there is no way it could be in `closedSet`. That will surely prevent your algorithm from …

Member Avatar for DarkLightning7
0
268
Member Avatar for Varunkrishna
Member Avatar for bguild
0
219
Member Avatar for Violet_82

The details are available here: http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html Format specifiers look like this: `%[argument_index$][flags][width][.precision]conversion` The number `6` is in the `[width]` position, which means that 6 is the minimum number of characters in the result. If the argument string has 6 characters or more, the argument string will be output as it …

Member Avatar for Violet_82
0
235
Member Avatar for somjit{}

The `add` documentation for `AbstractCollection` is actually rather shameful. When a class is designed to be extended the documentation should go far beyond merely explaining what each method does. A few preconditions and postconditions are fine documentation for a `final` method, but someone who is overriding a method also needs …

Member Avatar for somjit{}
0
173
Member Avatar for ankit.pandey3

This is something you can easily do yourself! Just take your numeral one digit at a time from left to right and keep an accumulator that starts at 0. For each digit, multiply the accumulator by the base and then add the value of the digit. You can reverse the …

Member Avatar for bguild
0
289
Member Avatar for Stuugie

The `exec` method does not necessarily use your command the same way that your command prompt uses it. Practically everything that `exec` does is operating system dependent, so it's hard to make any promises about how it should be used, but you shouldn't assume that it is as sophisticated as …

Member Avatar for Stuugie
0
682
Member Avatar for greyfox32

For those who don't know, a [`java.util.ConcurrentModificationException`](http://docs.oracle.com/javase/7/docs/api/java/util/ConcurrentModificationException.html) is thrown by some iterators when they detect that the collection has been modified. Very few iterators can tolerate modifications happening to the thing they are trying to iterate over in the middle of iteration, so you don't allow one thread to modify …

Member Avatar for bguild
0
259