-
Replied To a Post in Hailstone Sequence
It's so easy to re-generate the sequence given the starting number, so I wouldn't bother trying to store sequences. Just write a trivial `displaySequence(int startingNumber)` method - it's just the … -
Replied To a Post in Abstract class
1. If you get an error ALWAYS post the complete error message here. Don't exp3ect people to guess. 2. You are using AWT (Frame) rather than Swing (JFrame). AWT has … -
Replied To a Post in getting first char from each word in an input file
That code is so nearly right!. It's just that for the length of an array you use `myArray.length` not `myArray.length()` (yes, I know that's confusing - for a String it's … -
Replied To a Post in Theater Revenue
You have a load of JPanels that you don't need. You add the lables and fields to these panels, but that doesn't get them into the main mwindow. Forget the … -
Replied To a Post in Theater Revenue
Hello Susanna Thank you for sharing that with us, but is there any particular point you wanted to make, or question you wanted to ask? -
Replied To a Post in KeyListener to JFrame with Graphics
Everything to do with Swing (eg painting the screen, running actionPerformed methods) happens on a single thread - the "Event Dispatch Thread", or "EDT", or "Swing thread". That means that … -
Gave Reputation to Ismail_3 in JCreator help with program
hi all, i need lil help to do this program Students number = 10 Students name= Ahmed, Ismail, Mohammed, Esra, Ali, Omar, Abulla, Khalid, Talal, Sara Develop a program in … -
Replied To a Post in Libraries across computers?
Normally yes. -
Replied To a Post in collections
Looks like it moight be out of scope, but until you fix your indentation it's too hard to see. -
Replied To a Post in Swing panels inside classes.
I can't see how that could run without throwing Exceptions - eg line 117, deckPanel is not initialised, so that will throw a null pointer exception. How are you trying … -
Replied To a Post in Looping error
AFter entering 23 do you enter a space or a carriage return? (If you just type 23 the it will be waiting for the next character in case that will … -
Edited Java RMI help (in 'running' a simple ''Hello World'' program
//hello.java import java.rmi.*; public interface Hello extends java.rmi.Remote String sayHello() throws RemoteException; } //HelloImpl.java import java.rmi.Naming; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; public class HelloImpl extends UnicastRemoteObject implements Hello { public HelloImpl() … -
Replied To a Post in Java RMI help (in 'running' a simple ''Hello World'' program
Stub classes and rmic are not relevant! That stub class / rmic stuff went the way of the dodo years ago (obsolete as of Java 1.5 - 2004!). Unfortunately nobody … -
Replied To a Post in How to play mp3 files in java using eclipse?
... further to the JavaFX suggestion... just for fun I tried it. It's really easy, apart from one gotcha that took a little research. Anyway, here's the result You create … -
Replied To a Post in getting first char from each word in an input file
Your earlier version was almost there while ((line = reader.readLine()) != null) { String[] name = line.split(" "); //Fullname = name[0]; for(int i = 0; i < name.length(); ++i){ Initials … -
Replied To a Post in Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException:
In that case what about the following comment `// When currentState = 15, Run through the set once more for convergence.` because currentState can never be 15 when you reach … -
Replied To a Post in can anybody figure out the error of this program
You try to define method1 but you are still inside the main method. You ca't define a method inside another method. -
Replied To a Post in Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException:
I can't really comment on your logic because I have no idea what this program is supposed to do or how it is supposed to do it! However, this code … -
Replied To a Post in Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException:
OK. The only thing to do now is to put in a whole load of debugging print statements so you can narrow down exactly where it's going wrong. -
Replied To a Post in Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException:
Stop changing things at random. Understand why you get the error befroe trying to fix it. Line 100 - you get a random number 0 - 15 (ie Q_SIZE -1) … -
Replied To a Post in real time voice transmission
There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in … -
Replied To a Post in Socket Programming
There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in … -
Replied To a Post in Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException:
The exception relates to the R[][] array, which looks like [15][16] to me - so forget what I said about action, this is a problem with currentState==15. As before, you … -
Replied To a Post in Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException:
Q_SIZE is 16, which you use to get a value for action. So you get a random action in the range 0 - 15, which you use as an index … -
Replied To a Post in How to play mp3 files in java using eclipse?
Now Java 8 is out you should look at JavaFX (the replacement for Swing) which includes comprehensive media playing and is a fully-supported mainstream part of the Oracle Java API. … -
Replied To a Post in getting first char from each word in an input file
(A small digression for anyone who has noticed that Java 8 is now released, so we have Lambdas and Streams to use for this problem. Here's a solution using current … -
Replied To a Post in getting first char from each word in an input file
"\n" is the new line character. YOu read the file line-by-line, so that process strips the new line characters and gives you each line without a \n. So splitting on … -
Replied To a Post in getting first char from each word in an input file
Your code is almost right - you have the right pieces but the order is a bit messed up. Read each line of the file, split each line into words … -
Replied To a Post in I want to scan 123456789 and display 123 456 789 beside the prompt
Strings in Java are immutable - you cannot change them. Have a look at StringBuilder which is like a String but you can do stuff like inserting blanks into the … -
Replied To a Post in Java RMI help (in 'running' a simple ''Hello World'' program
I don't want to upset you, but RMI is an advanced Java topic, and if you are unsure about how to compile a java file then you are not ready … -
Replied To a Post in java beginners
Yes, there are lots, but be careful - some are of low quality, and many are out of date. Sorry I can't give you any personal recommendations. The one tutorial … -
Replied To a Post in java beginners
Check out the very first post in the Java forum "Starting Java [Java tutorials / resources / faq]" http://www.daniweb.com/software-development/java/threads/99132/starting-java-java-tutorials-resources-faq There are excellent book recommendations in there -
Replied To a Post in repaint()
The problem is probably in the code you didn't post! Eg: If you don't set a size and/or minimum size for your mypanel then the layout manager for its parent … -
Replied To a Post in How to play mp3 files in java using eclipse?
Hi milil Please don't EVER do this in code that a learner may read: catch(Exception ex) { } all you are doing is guaranteeing that when it goes wrong they … -
Replied To a Post in Java RMI help (in 'running' a simple ''Hello World'' program
What exactly are you saying here? Sounds like "I don't like any of the tutorials on the web, so write one just for me"? Anyway - you don't need to … -
Replied To a Post in Populating a Java ArrayList with User Input
This arraylist is a list of Document objects ArrayList<Document> someStuff = new ArrayList<Document>(); The application prompts the user for lastname, firstname, code and then uses those values to create new … -
Replied To a Post in Confused - java program compile issue
Try TimeUnit.SECONDS or chnage the import to import static java.util.concurrent.TimeUnit.*; -
Replied To a Post in Confused - java program compile issue
Sharing the exact complete error message always helps... -
Replied To a Post in matrix sorting in ascending order
You need to decide what you mean by sorting a 2D matrix. The code you have sorts each row individually - which is one passible answer, but it looks like … -
Replied To a Post in An alternative to java.util.Date;
Date was badly designed in version 1 of Java because it didn't cope with multiple time zones or calendars. For most purposes it was replaced by the abstract Calendar class. … -
Replied To a Post in Problem with ConfigurationManager
You declare the array variable `som` but you don't initialise it, so som is still null, it doesn't refer to an array yet, the array doesn't exist, it has no … -
Replied To a Post in Compared to function as a result
How about returning a boolean? // pseudo-code! public boolean passwordIsOK() { get the password if (the password is correct) return true; else return false; } then you can say if … -
Replied To a Post in how to call method non static in method static
ConnFactory is better than OConnection -
Replied To a Post in Java Suggestion needed
Answers, as always in the JLS... but in short: integer literals are always treated as `int` unless they have a "l" at the end (JLS 3.10.1). f.p. literals are always … -
Replied To a Post in how to call method non static in method static
That looks a lot better to me. -
Replied To a Post in how to call method non static in method static
Nice OO thinking - the User class is excellent, but the other class... horrible naming! A method called `OConnexion` in a class called `OConnection` that returns a `Connection` is guaranteed … -
Replied To a Post in Java Suggestion needed
Java will autobox/unbox int<->Integer, double<->Double,etc, so milil's example is OK. -
Replied To a Post in ATM with pin number
You just copy/pasted your assignment without even a moment taken to explain what help you need. That's highly disrepestectful to the many people who give their time to help others … -
Replied To a Post in project ideas
I guess you missed the very first post at the top of the first page of the Java forum? -
Replied To a Post in how to call enum string in field, resort array
Rather than using println with tabs, you will get better results using printf (like line 91) so you can specify the width and alignment of each field. I see you …
The End.