Search Results

Showing results 1 to 40 of 421
Search took 0.03 seconds.
Search: Posts Made By: javaAddict
Forum: Java 17 Hours Ago
Replies: 4
Views: 91
Posted By javaAddict
for (int i = 0; i < adj2.length; i++) {
for (int j = 0; j < adj2.length; j++) {
path += adj[i][j]*adj[j][i];
}
}


The above always returns 0. If you run the code by hand you will see...
Forum: Java 2 Days Ago
Replies: 2
Views: 285
Posted By javaAddict
You haven't described what is your problem and what have you done so far. Don't expect us to read the entire code and see what works and what doesn't.
Also you are mixing everything up.

Forget...
Forum: Java 4 Days Ago
Replies: 2
Views: 166
Posted By javaAddict
Use a for loop, to loop through the ArrayList and print its elements instead of the System.out.println(row1)
Forum: Java 7 Days Ago
Replies: 8
Views: 302
Posted By javaAddict
I ran this:

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

// Its elements are so you need to initalize them
array[0] = new RockSong();
...
Forum: Java 7 Days Ago
Replies: 8
Views: 302
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 7 Days Ago
Replies: 8
Views: 302
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 8 Days Ago
Replies: 2
Views: 191
Posted By javaAddict
I don't really get the above, but I have a few corrections to add.

First, don't use the toString method of the exception. Use the getMessage to print the error.

String output2 = "Incorrect...
Forum: Java 9 Days Ago
Replies: 5
Views: 240
Posted By javaAddict
The split returns an array. And you try to cast it to ArrayList.
From the String get the String [] array using the split method.
Then loop through the array and add its elements to an ArrayList
Forum: Java 10 Days Ago
Replies: 5
Solved: Advice needed!
Views: 345
Posted By javaAddict
I think you should keep your code they way it was and return the index where the target element was found. Without increasing it by 1. In your methods you should always return indexes the way they...
Forum: Java 12 Days Ago
Replies: 4
Solved: Error in Java
Views: 260
Posted By javaAddict
You can make the method static. Like the main.
Forum: Java 12 Days Ago
Replies: 4
Solved: Error in Java
Views: 260
Posted By javaAddict
As the error says, You cannot call a non-static method inside a static method.
Forum: Java 13 Days Ago
Replies: 3
Views: 217
Posted By javaAddict
Check the API.

p.addActionListener(new gameinit());

The JFrame class doesn't have such method: addActionListener.
Then search the API some more to find which elements accept an ActionListener...
Forum: Java 13 Days Ago
Replies: 3
Views: 217
Posted By javaAddict
In order for this method to execute:

public void actionPerformed(ActionEvent e)
{
Izzy.hittable();
Izzy.movement();

if(rar == 'T')
{
System.out.print("Sky High(Grand...
Forum: Java 13 Days Ago
Replies: 5
Solved: Advice needed!
Views: 345
Posted By javaAddict
Well since you found the number you know one of the occurrences of the number.
Assume this:
You are looking for '3'

And you find the position of the "Red" 3. So all the others 3s will be either...
Forum: Java 15 Days Ago
Replies: 2
Views: 289
Posted By javaAddict
You can check the API to see if there is a way to get the data from the table.
Forum: Java 15 Days Ago
Replies: 7
Views: 280
Posted By javaAddict
This thread has already been solved and you added no additional information.
Also using eclipse will not solve the problem but it will make it bigger because the user will not have learned a thing...
Forum: Java 16 Days Ago
Replies: 7
Views: 339
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 16 Days Ago
Replies: 4
Views: 215
Posted By javaAddict
I don't know. Have you checked the API for Treemap?
Forum: Java 16 Days Ago
Replies: 7
Views: 280
Posted By javaAddict
Try run it without the .class extension:
> java Hi

Then post the error that you will get :)
Forum: Java 16 Days Ago
Replies: 16
Solved: Append to array
Views: 645
Posted By javaAddict
You need to use java.util.Date, not java.sql.Date.
Forum: Java 16 Days Ago
Replies: 7
Views: 339
Posted By javaAddict
Yes, but you didn't say what the error is. The code seems fine. What is your problem?

Also you should post a few lines of the file you are reading.
Also check the API for the class: Scanner:...
Forum: Java 17 Days Ago
Replies: 14
Views: 466
Posted By javaAddict
I would suggest, before asking such questions, first to check the java API:
java API (http://java.sun.com/j2se/1.5.0/docs/api/overview-summary.html)
javax.swing...
Forum: Java 17 Days Ago
Replies: 14
Views: 466
Posted By javaAddict
You don't need the newPatron object. In the if statements you will only have one instance. You will not have an instance of the super class. Only of child classes. The way you have it in the if...
Forum: Java 18 Days Ago
Replies: 16
Solved: Append to array
Views: 645
Posted By javaAddict
Isn't this suppose to throw an ArrayIndexOutOfBounds Exception?:

names[names.length] = ...

names's length is 1
java.lang.ArrayIndexOutOfBoundsException: 1
Forum: Java 18 Days Ago
Replies: 14
Views: 466
Posted By javaAddict
Inside the actionPerformed you can try this:

private void actionPerformed(ActionEvent event) {
// assuming that you have a list globally of type Patron (the super class)

if (radioButton1...
Forum: Java 19 Days Ago
Replies: 4
Solved: 2D array
Views: 247
Posted By javaAddict
The phone[][] is null. That is why you are getting the exception.

And no this:

String phone[][] = { {"A", "B","C"},
{"D", "E", "F"},
{"G","H", "I"},
{"J", "K", "L"},
...
Forum: Java 19 Days Ago
Replies: 14
Views: 466
Posted By javaAddict
I didn't quite realize your problem but here are some suggestions.

You can have one class with all the info and you can have one field indicating what type it is. You can have if-statements that...
Forum: Java 19 Days Ago
Replies: 4
Solved: 2D array
Views: 247
Posted By javaAddict
We need to see more code
Forum: Java 19 Days Ago
Replies: 14
Views: 466
Posted By javaAddict
I am not familiar with the classes of the javax.swing you are using but my experience tells me this:

Firstly, I assume that the method you use to add the book to the list takes as argument an...
Forum: Java 20 Days Ago
Replies: 14
Views: 466
Posted By javaAddict
Because this:
123456789123
is not an int, it's a long.

It is a classic mistake when you try to use a big number. If you check the API you will see how big an int can be.

What value does this...
Forum: Java 20 Days Ago
Replies: 14
Views: 466
Posted By javaAddict
These lines are incorrect:

GetBookDetails();
newBook = new Book (IDNum, Title,Author,Publishr,CatNumPublicationYr,returnDate,BookStat,ISBN);


with the GetBookDetails you get all the date from...
Forum: Java 20 Days Ago
Replies: 4
Views: 233
Posted By javaAddict
If you run this code you will see that '==' doesn't work:

public static void main(String [] args) {
String s1 = new String("aa");
String s2 = new String("aa");

...
Forum: Java 29 Days Ago
Replies: 2
Views: 169
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: JSP 29 Days Ago
Replies: 1
Views: 377
Posted By javaAddict
When the user logs in, do you put that user in the session?

String username;
String password;

// check the database to see if the user is valid.
if (yes) {
...
Forum: Java 32 Days Ago
Replies: 21
Views: 653
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 32 Days Ago
Replies: 21
Views: 653
Posted By javaAddict
Vector vIf = new Vector();

....
// inside the while loop
if (line.equals("if")) {
Freq[1] = Freq[1] + 1;
vIf.add(lineCount);
}
Forum: Java 32 Days Ago
Replies: 19
Views: 541
Posted By javaAddict
You know very well that this is not the way to declare variables:

int firstnumber = 1,2,3,4,5,6,7,8,9,10,11,12,13;
int secondnumber = 1,2,3,4;

If you can't fix this, don't go any further.
...
Forum: Java 32 Days Ago
Replies: 19
Views: 541
Posted By javaAddict
The ones between the "" are strings and they will be printed they way they are. Surely you have written the Hello World program:

System.out.println("Hello World");

System.out.println("Row...
Forum: Java 33 Days Ago
Replies: 19
Views: 541
Posted By javaAddict
What do you mean by "X".
Maybe this:

number " + loops + " " + loops + " x " + num + " = " + result);
Forum: Java 33 Days Ago
Replies: 2
Views: 241
Posted By javaAddict
Be more careful!!.
You missed the postcode. Count your arguments.
Showing results 1 to 40 of 421

 


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

©2003 - 2009 DaniWeb® LLC