Search Results

Showing results 1 to 40 of 79
Search took 0.01 seconds.
Search: Posts Made By: javaAddict ; Forum: Java and child forums
Forum: Java 4 Days Ago
Replies: 8
Views: 256
Posted By javaAddict
After taking a closer look at the code you don't need the casting. Since you read from the file a Music object, it doesn't matter what type of music it is:


while (true) {
Music music =...
Forum: Java 4 Days Ago
Replies: 8
Views: 256
Posted By javaAddict
Even though from your code you have figured out on your own how to use array of objects here is a small example:

Music [] array = new Music[3]; // array is an array and it is not null

// Its...
Forum: Java 9 Days Ago
Replies: 4
Solved: Error in Java
Views: 216
Posted By javaAddict
You can make the method static. Like the main.
Forum: Java 10 Days Ago
Replies: 7
Views: 246
Posted By javaAddict
After searching for examples on the net, I found this:
Assuming your file is like this:

And you run this:

RandomAccessFile raf = new RandomAccessFile("fileName","rw");
...
Forum: Java 10 Days Ago
Replies: 7
Views: 246
Posted By javaAddict
I think that the RandomAccessFile (http://java.sun.com/j2se/1.5.0/docs/api/java/io/RandomAccessFile.html) might help you.
Forum: Java 12 Days Ago
Replies: 1
Views: 155
Posted By javaAddict
I would have used the sleep method:

// line read:
line = readLine();

// take the time at the end of the line:
lone time = ... ;

try {
Thread.sleep(time);
Forum: Java 13 Days Ago
Replies: 7
Views: 307
Posted By javaAddict
Because you only have ONE tempPerson object. You have the same instance of it:



tempPerson.setPerson(tempName, tempAddress, tempBirthDate);

System.out.println(tempPerson.getLastName()); //...
Forum: Java 13 Days Ago
Replies: 4
Views: 202
Posted By javaAddict
It will work, but don't forget that each element of the iterator will have one of these:
java.util.Map.Entry (http://java.sun.com/j2se/1.4.2/docs/api/java/util/Map.Entry.html)
Forum: Java 13 Days Ago
Replies: 7
Views: 262
Posted By javaAddict
Try run it without the .class extension:
> java Hi

Then post the error that you will get :)
Forum: Java 13 Days Ago
Replies: 16
Solved: Append to array
Views: 582
Posted By javaAddict
You need to use java.util.Date, not java.sql.Date.
Forum: Java 17 Days Ago
Replies: 3
Views: 209
Posted By javaAddict
You aren't making any sense
Forum: Java 26 Days Ago
Replies: 2
Views: 164
Posted By javaAddict
At the validation I believe that the seconds should until 59. For the hours you 23, 59. Why not the same for seconds.

For the extract when you multiply and then do a mod, you will get 0.

123 *...
Forum: Java 26 Days Ago
Replies: 4
Views: 253
Posted By javaAddict
Your first code will not compile and it is not java (elif)

The second is totally inefficient and shows no thinking at all to the real problem
Forum: Java 29 Days Ago
Replies: 21
Views: 641
Posted By javaAddict
Actually I understood that the objective was to monitor how many times a word appeared.
I would suggest sth like this:

String word;
Vector linesAppeared;

And the size of the vector would be...
Forum: Java 34 Days Ago
Replies: 4
Views: 248
Posted By javaAddict
Was the assignment given to you today? If no, then what were you doing all this time? If yes, then you have a very demanding teacher.



Does this mean that next time you will do it on your...
Forum: Java Oct 23rd, 2009
Replies: 19
Views: 1,131
Posted By javaAddict
I haven't look at your code but from your explanation, I assume that you create the second frame, when the button is clicked?
If yes declare the second frame as global variable and create it once....
Forum: Java Oct 23rd, 2009
Replies: 6
Solved: arrays
Views: 267
Posted By javaAddict
public static float average(short [] grades) {
// calculate the average using a for loop
}


And to call it after you have your array created and entered values in it:

short [] grades =...
Forum: Java Oct 17th, 2009
Replies: 6
Views: 314
Posted By javaAddict
I don't think it's possible. Whenever you type something it is stored in the variable, therefor you need an if statement, but I would suggest to wait for other people responses as well in case...
Forum: Java Oct 16th, 2009
Replies: 3
Views: 316
Posted By javaAddict
Sorry for my double post but when you are done with your solution, there is a much smarter - but more difficult - way you can try:

String [] words = {"Alpha", "Bravo", ....};


Now when you get...
Forum: Java Oct 13th, 2009
Replies: 2
Views: 160
Posted By javaAddict
Providing private lessons is not what we do here. Check the Read Me thread with the tutorials on top of this forum, and we will answer specific questions about any errors you might get with your code
Forum: Java Oct 12th, 2009
Replies: 1
Views: 491
Posted By javaAddict
In case you haven't noticed we have October. Tanning is out of the question, unless you plan to use the application at the South hemisphere.
Forum: Java Oct 8th, 2009
Replies: 1
Views: 200
Posted By javaAddict
Usually a NullPointerException means that you are trying to use something that is null. So if you get the exception at line 63:

_file.pixels[x][iy].setValue("b");

it would mean that:...
Forum: Java Oct 7th, 2009
Replies: 19
Views: 1,131
Posted By javaAddict
From what I see you use a lot of "extending" that I don't think is necessary. Your code works but it could have been simpler.
First don't use the "dispose" method.

Second you need to close the...
Forum: Java Oct 6th, 2009
Replies: 4
Views: 297
Posted By javaAddict
I think he wants a javax.swing.* program.

What you ask is impossible because we don't know your requirements. We cannot just start writing a program that does nothing using random commands with no...
Forum: Java Oct 6th, 2009
Replies: 2
Views: 275
Posted By javaAddict
I believe that your problem is this:


String s1 = new String( secondLength );
....
lastName.getChars ( 0, 5, secondLength, 0 );

When you create the "s1" the "secondLength" array is empty....
Forum: Java Oct 2nd, 2009
Replies: 9
Views: 305
Posted By javaAddict
for (int l = 0; l < info.length; l++){
info[l] = loadPlayerPositions.readLine();

info[0] = Players.nameOfPlayer1.toString();
info[1] =...
Forum: Java Sep 25th, 2009
Replies: 6
Views: 330
Posted By javaAddict
Can you see something wrong with this code:


public void setName(String appt){
setName(appt);
}


You calling the same method. When you call setName it will call setName which is...
Forum: Java Sep 4th, 2009
Replies: 6
Views: 491
Posted By javaAddict
I don't know if it is possible to get the "My Computer" as root, but check this out:

File [] files = File.listRoots();
for (int i=0;i<files.length;i++) {
...
Forum: Java Sep 3rd, 2009
Replies: 7
Views: 392
Posted By javaAddict
The only bug I see is you accusing a programming language which has been around for decades, used by thousands, for your incompetence.

Just because you can't get it to work doesn't mean it has a...
Forum: Java Sep 2nd, 2009
Replies: 11
Views: 295
Posted By javaAddict
Yes, we are good at it

What does this suppose to mean? Have you any idea what you are asking. It's not enough that you cheated at your assignment, you have the nerve to tell us that you cheated...
Forum: Java Aug 20th, 2009
Replies: 4
Views: 328
Posted By javaAddict
I get it now.
I was sent a PM from chingkoysilog (the OP) asking to give him the solution of an assignment that involved salespersons and calculating some total values per products and ...
Forum: Java Aug 2nd, 2009
Replies: 2
Views: 469
Posted By javaAddict
First of all I find it surprising that you wrote this code and still couldn't find the answer.
I mean was it so difficult to add this to your code?


if (lineNo==5134)
{
line = br.readLine();...
Forum: Java Jul 27th, 2009
Replies: 9
Views: 744
Posted By javaAddict
Classes begin with capital. Methods with lower.


StringConcatenate stringConcatenate1 = new StringConcatenate();
stringConcatenate1.stringConcat();


You create an object/instance of type...
Forum: Java Jun 15th, 2009
Replies: 8
Views: 365
Posted By javaAddict
No you shouldn't use unicode for declaring methods and variables.
You use unicode for unsupported characters. If your keyboard has the 'a' then use it for the name of your method. What's the point...
Forum: Java Jun 12th, 2009
Replies: 2
Views: 202
Posted By javaAddict
From what I understood, first you delete and then you insert, when you want to do an Update.

Well you can try and run an Update query. When you "SELECT" data from the database you use a userID as...
Forum: Java Jun 9th, 2009
Replies: 7
Views: 1,036
Posted By javaAddict
Do you have somewhere another class named Random?
Forum: Java Jun 8th, 2009
Replies: 6
Views: 396
Posted By javaAddict
You will find no servants here that are obligated to answer to your questions. If you didn't get a reply it was probably because people didn't know the answer or they were busy with their own...
Forum: Java Jun 4th, 2009
Replies: 4
Views: 250
Posted By javaAddict
The answer is simple English grammar:

A method throws an Exception:

public void method(int i) throws Exception {

}

The method throws an Exception when you call it
Forum: Java May 20th, 2009
Replies: 4
Views: 611
Posted By javaAddict
setModel (http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JTable.html#setModel(javax.swing.table.TableModel))

Also check the
TableModel...
Forum: Java Apr 27th, 2009
Replies: 5
Views: 710
Posted By javaAddict
Well this is what I got with mixed numbers:

It should have returned '3'.

After searching the API for collections (http://java.sun.com/javase/6/docs/api/java/util/Collections.html)
found that...
Showing results 1 to 40 of 79

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC