1,963 Posted Topics

Member Avatar for Mikesvb

We'll be happy to help anyone by giving ideas for their algorithm or debuging some part of the code, but don't expect for someone to read your entire code in order to figure out what is wrong when you the only comment you have made is saying that the code …

Member Avatar for jbennet
0
118
Member Avatar for Ankita B

Put it wherever you want, as long as you say in your code where is it so you can read it: props.load(new FileInputStream("dbConnection.properties")); When you make changes in your .properties files, you must restart the server

Member Avatar for Ankita B
0
141
Member Avatar for kilermage

To start with the class's constructor is wrong declared: Right way: [CODE] class SomeClass { public SomeClass() { } } [/CODE] Wrong way: [CODE] class SomeClass { public [B]void [/B] SomeClass() { } } [/CODE]

Member Avatar for stultuske
0
156
Member Avatar for eddy556

I think that the concept of the query is wrong. If you want to perform an INSERT then you don't need a WHERE ID= [I]id[/I] because you are inserting something that does not exist. Perhaps you should try an UPDATE

Member Avatar for masijade
0
404
Member Avatar for Noliving

The toString() method MUST stay with the same name. In java, the toString() is not a method of String object but of the Object class. And you must override it in your class. ex: when you call: [CODE] Person p = new Person(....); System.out.println(p); [/CODE] Then the system.out, automatically calls …

Member Avatar for javaAddict
0
143
Member Avatar for brinze

The method Math.random() returns a random [U]double[/U] between 0 and 1. 0 < Math.Random <1; So one variation of jwenting's post : [CODE] private int diceRoll() { double r=Math.Random(); //do stuff return /* An [U]int[/U] number between 1 and 6 */ } [/CODE]

Member Avatar for brinze
0
141
Member Avatar for delosoa

[CODE] case 5: z=m5*Quantity; total += z; count++; break; } [COLOR="red"]total += z;[/COLOR] count++; JOptionPane.showMessageDialog(null,"The total Retail Price is "+total,"RESULT", JOptionPane.INFORMATION_MESSAGE); } if(choice==-1){ [COLOR="red"]total +=choice;[/COLOR] count++; JOptionPane.showMessageDialog(null,"The total Retail Price is "+total,"RESULT", JOptionPane.INFORMATION_MESSAGE); } [/CODE] First red: why do you add the total again, when you have already added it …

Member Avatar for javaAddict
0
110
Member Avatar for AS_82

Try something like this: [CODE] double[] getBubbleSort(double[] values) { double [] newArray = new double[values.length]; for (int i=0;i<values.length;i++) { newArray[i] = values[i]; } //your code here return newArray; } [/CODE]

Member Avatar for javaAddict
0
93
Member Avatar for Rasjoe

I don't if this is correct but what I did once, was to read the file line by line(like you read any other text file). You will get numbers. These numbers represent the RGB values. They are from 0 - 16777216 (256*256*256).

Member Avatar for Rasjoe
0
98
Member Avatar for JoePie

Are you using the KeyListener or the ActionListener? If you want the input to be from the keyboard then I wouldn't use JButtons.

Member Avatar for JoePie
0
1K
Member Avatar for kabo

What I don't understand is that when he says: [QUOTE] (a2+b2+1)/(ab) [/QUOTE] Does he mean: (a*2+b*2+1)/(a*b)?

Member Avatar for stultuske
0
134
Member Avatar for CBLACK10

When you press close you have to call the setVisible(true) of the original Menu Window and the setVisible(false) of the add record window. Probably you don't have access to the Menu Window from the add window. Try this In the Menu Window when you call add-window, have it take as …

Member Avatar for new_2_java
0
113
Member Avatar for arunpawar

They are different packages with different classes. If you want a class that is inside java.package then import java, or else import javax.

Member Avatar for javaAddict
0
65
Member Avatar for dharajsmith

First of all no one is going to spend his precious time trying to understand what you are writing in the way you are writing it. Not even you don't use code tags, but also I cannot understand if you are posting two different files (classes) or one, or where …

Member Avatar for dharajsmith
0
183
Member Avatar for nljavaingineur

You are declaring total twice: [CODE] double total; //declarations of the neccesary variables int amt; double unitPrice,sum; String product; String ttl; int index=0; double total=0; [/CODE]

Member Avatar for jwenting
0
108
Member Avatar for Derice

Try adding a System.out.println(); before the JOptionPane to see where the program stops

Member Avatar for Derice
0
201
Member Avatar for javaStud

Inside the: UserListIn.add(GymUser newGymUser) method you will take the new Gym User and compare him with the other gymUsers. If one with the same id already exists then don't add him and print a message or throw an Exception. If you don't want to make this check inside the .add …

Member Avatar for javaAddict
0
232
Member Avatar for rickster11

And when you are receiving an error, that you don't know in a line where you are calling a lot methods one inside another, try to break it a bit: [CODE] String stringToParse = line.substring (line.indexOf(","),line.length()); System.out.println(stringToParse); int num = Integer.parseInt(stringToParse ); blocksArray [numBlocks][1] = num ; [/CODE] In that …

Member Avatar for javaAddict
0
104
Member Avatar for alejalv

I believe that you should write a return statement at the end of your "public static int calcFib (int n)" method. From what I have seen you have return statements in all of your if () { }, but I think that in some versions of the java you need …

Member Avatar for DangerDev
0
92
Member Avatar for suzy_naresh

You cannot move one TextField to another. If you want to change focus, use the focusListeners, and/or the keyListeners. I think there is a method at TextField that sets the focus. If you want to write to a text Field something from another use the getText(), setText() methods. Also check …

Member Avatar for javaAddict
0
83
Member Avatar for fatjoy25

What exception, where is it thrown, what is the message? And what is your question????? The title of the post is not meant for asking questions

Member Avatar for jwenting
0
75
Member Avatar for KimJack

What do you mean referencing an array from another class? What are you trying to do?

Member Avatar for ~s.o.s~
0
99
Member Avatar for balaguru

It's seems to me that you already have some ideas. If you don't like them then we cannot know what you would like to do. By the way, what YOU would like to do? Find that out and then [B]Just Do It[/B]

Member Avatar for manu9719198933
-1
86
Member Avatar for ladyjade555

I also don't think that this correct: [CODE] public double GreatCircleDistance(lat, lon, alt) { } [/CODE] Shouldn't be : [CODE] public double GreatCircleDistance(double lat,double lon,double alt) { } [/CODE]

Member Avatar for javaAddict
0
108
Member Avatar for Questions???

First of all why create two classes that do the same thing: UserInput1,UserInput2? Just create only one that prints the message: "Give a number" and create two different instances: [CODE] UserInput1 firstNumber = new UserInput1(); int input1 = firstNumber .getUserInput1(); UserInput1 secondNumber = new UserInput1(); int input2 = secondNumber .getUserInput1(); …

Member Avatar for ~s.o.s~
0
99
Member Avatar for fufu123

Didn't I answer that already? [URL="http://www.daniweb.com/forums/post521775.html#post521775"]http://www.daniweb.com/forums/post521775.html#post521775[/URL]

Member Avatar for fufu123
0
176
Member Avatar for Webbsta

Compile it, I think if you are console the command is >javac InputHandler.java (if I remember correctly because for a very long time I have been using IDEs) and run it with the command >java InputHandler Then the program will print the message in your code and then just insert …

Member Avatar for Webbsta
0
308
Member Avatar for jessxe02

Assuming that you want to sort an array of numbers then declare your array, read from the input then numbers and store each one of them in the array and then call a method that sorts the array: For reading I use this: [CODE] BufferedReader USERIN = new BufferedReader (new …

Member Avatar for Ezzaral
0
75
Member Avatar for sourcerer
Re: Srtf

First of all create a Job object like I told you. Then a method that takes as argument the Jobs (array,vector, or anything else you want with Job objects) and write your code there. Do you know how to sort an array because I think you have to do something …

Member Avatar for javaAddict
0
85
Member Avatar for hidash_in

[CODE]byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); }[/CODE] Personally, I don't use very often this kind of way to read files, but why don't you try what masijade has suggested with renaming the file. Do you have access to the …

Member Avatar for masijade
0
300
Member Avatar for Ankita B

Why don't you post your code, the exception that was thrown and the stack trace. How are we supposed to understand what is the problem? Ask the Oracle from the Matrix:icon_wink: ?

Member Avatar for masijade
0
61
Member Avatar for ashkash

[QUOTE]Sorry I am a little confused. Each entry in the java list is in the format: XXXXX,XX/XX/XXXX So if I use String.split(",") it would return an array of Strings as follows: XXXXX,XX/XX/XXXX,XXXXX,XX/XX/XXXX... is this correct?[/QUOTE] If you use split for the XXXXX,XX/XX/XXXX: [CODE] String s="XXXXX,XX/XX/XXXX"; String [] tokens =s.split(","); [/CODE] …

Member Avatar for javaAddict
0
116
Member Avatar for piers

No, no, no. The way I see it each Card object must represent a single card the suit, rank must not be arrays. The constructor will take the 2 values and you will pass these values to your class attributes. Both attributes will be Strings. You will have no problem …

Member Avatar for Ezzaral
0
144
Member Avatar for babyfrostie

What do you mean prove it? You DON'T have to prove, it is just the way it is. Do you mean implemented using recursive?

Member Avatar for babyfrostie
0
82
Member Avatar for soccerrm1

Have you set the environment variables? You have to state where the javac command is. Also if you open the command prompt and type java it should print the java version you are using.

Member Avatar for javaAddict
0
214
Member Avatar for fufu123

quarters, dimes, nickels, pennies must be int [CODE] quarters= int(change/25); dimes= int(change/10); nickels= int(change/5); pennies= int(change/1); [/CODE]

Member Avatar for Ezzaral
0
236
Member Avatar for fatjoy25

You cannot run an Applet using main(String [] args) You must use an HTML page. And I think I've seen the same question to another thread, that had the same answer.

Member Avatar for Ezzaral
0
156
Member Avatar for push

A good tutorial about html can be found here : [URL="http://www.w3schools.com/"]http://www.w3schools.com/[/URL]

Member Avatar for javaAddict
0
67
Member Avatar for dmotah

Your class must extend the Thread class and implement the run method. (void run()) When your class runs that method it is executed in parallel with any other thread, included the main(String [] args). So just create a class that stores the random numbers in an array. Code must go …

Member Avatar for javaAddict
0
93
Member Avatar for mentallybroken

The while statement is correct. You don't need the A; it is in the Q where you store your input and that's what you want to modify. If you look your code you will see that you write Q=A/2 without giving any values to A in the first place. You …

Member Avatar for javaAddict
0
81
Member Avatar for shaikh_mshariq
Member Avatar for zaibitreg

What????? NetBeans released the 6.0? That's amazing. I am still using the 0.0.0.0.1 version:icon_lol: I am going to download it with my PSTN 28kbps connection. By the time it gets downloaded, the 7.0 will be released :icon_lol:

Member Avatar for jwenting
0
99
Member Avatar for arunpawar

When you say that you downloaded them, in what form did you get them? (Perhaps a .jar file)

Member Avatar for jwenting
0
448
Member Avatar for Derice

Try something like this: [CODE](int)Math.pow(y,2);[/CODE] or [CODE]System.out.println((int)Math.pow(y,2));[/CODE] if you want to print

Member Avatar for javaAddict
0
89
Member Avatar for Adami

Try using str.charAt(i) in a for-loop. This method returns one by one each char of the String. Then you can count the different brackets that open and close and make sure that each time the bracket count must be positive or zero. At the end of the loop [U]all[/U] bracket …

Member Avatar for iamthwee
0
95
Member Avatar for Adami

Returns true if each "father" can be divided by each of their "sons". false even if one of the fathers cannot be divided by theirs sons. If a node is null, it does not check it and returns true.

Member Avatar for javaAddict
0
285
Member Avatar for musaka

Finally, this is first time I've seen in this forum someone start a thread with the title:'Need help' and not asking for the solution to his homework without having written any code for himself.

Member Avatar for javaAddict
0
110
Member Avatar for nljavaingineur

You create a double number2 at the beginning of your program, but in the function: button3_actionPerformed you create another Double number2. This is not wrong, but the calculateResult function takes as arguments: 1 String and 2 double. The number2 you are passing is not a double primitive type but a …

Member Avatar for Ezzaral
0
102
Member Avatar for reiyn17

And you should be thankful that glowkazaf told you how to do it in the first place even though the way you asked for help was rude. If you opened a Java book you would have found out that what you are being asked to do is the simplest thing …

Member Avatar for lovely12
0
288
Member Avatar for babyfrostie

Since you don't know the size of the file why don't you put the strings you read into a Vector and then put the data from the Vector to an array ex: String line= readLine() from file vector.add(line) When you are done with the file use a for-loop to put …

Member Avatar for PoovenM
0
143

The End.