Click here to Skip to main content
15,920,633 members
Home / Discussions / Java
   

Java

 
QuestionHow to know user still connect to my website in local network ? Pin
tannghia28-Aug-11 17:28
tannghia28-Aug-11 17:28 
AnswerRe: How to know user still connect to my website in local network ? Pin
jschell29-Aug-11 9:10
jschell29-Aug-11 9:10 
Questioni got java.lang.NullPointerException error while delteing and adding new data inms access DB-pls guide me to solve Pin
jpljayapal27-Aug-11 8:42
jpljayapal27-Aug-11 8:42 
AnswerRe: i got java.lang.NullPointerException error while delteing and adding new data inms access DB-pls guide me to solve Pin
jschell28-Aug-11 8:08
jschell28-Aug-11 8:08 
QuestionComputer talks to u Pin
Had12327-Aug-11 5:48
Had12327-Aug-11 5:48 
AnswerRe: Computer talks to u Pin
Smithers-Jones27-Aug-11 23:48
Smithers-Jones27-Aug-11 23:48 
QuestionGetting the lowest values in one array, and then counting them. Pin
Tor Danielsen25-Aug-11 7:27
Tor Danielsen25-Aug-11 7:27 
AnswerRe: Getting the lowest values in one array, and then counting them. Pin
AspDotNetDev25-Aug-11 8:46
protectorAspDotNetDev25-Aug-11 8:46 
Tor Danielsen wrote:
if(waste[i]<waste) {


First of all, I'm guessing this is a typo and that second "waste" should be "maksDager":
Java
if(waste[i]<maksDager) {

Secondly, you should not initialize maksDager to 0. You should initialize it to one of the values in the waste array (note: what would happen if all the values in the array are a value of 1 or greater?):
Java
if(waste.length > 0) {
    maksDager = waste[0];
}


You could reset and increment sum like this:
Java
if(waste[i] == maksDager) {
    sum++;
}
if(waste[i] < maksDager) {
    maksDager = waste[i];
    sum = 1;
}


It's been a while since I used Java, so I can't remember how to chain else if statements and I don't remember if you need double equal signs (==) to check for equality, but you get the idea.

Finally, I have no idea what "maksDager" stands for. Perhaps rename it to something like "lowest".
Martin Fowler wrote:
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.

GeneralRe: Getting the lowest values in one array, and then counting them. Pin
Tor Danielsen25-Aug-11 10:25
Tor Danielsen25-Aug-11 10:25 
Questionsound in java Pin
Mhmud emam24-Aug-11 19:48
Mhmud emam24-Aug-11 19:48 
AnswerRe: sound in java Pin
Firo Atrum Ventus24-Aug-11 19:55
Firo Atrum Ventus24-Aug-11 19:55 
QuestionCPU usage per process Pin
kartikdasani22-Aug-11 1:42
kartikdasani22-Aug-11 1:42 
AnswerRe: CPU usage per process Pin
Richard MacCutchan22-Aug-11 2:20
mveRichard MacCutchan22-Aug-11 2:20 
AnswerRe: CPU usage per process Pin
jschell22-Aug-11 9:33
jschell22-Aug-11 9:33 
GeneralRe: CPU usage per process Pin
David Skelly22-Aug-11 22:01
David Skelly22-Aug-11 22:01 
Questionstegnography in java Pin
ROHIT_BHATIA21-Aug-11 8:00
ROHIT_BHATIA21-Aug-11 8:00 
AnswerRe: stegnography in java Pin
David Skelly21-Aug-11 22:00
David Skelly21-Aug-11 22:00 
AnswerRe: stegnography in java Pin
Manfred Rudolf Bihy22-Aug-11 3:53
professionalManfred Rudolf Bihy22-Aug-11 3:53 
QuestionJava Applet not drawing to screen [modified] Pin
Liam S. Crouch20-Aug-11 4:33
Liam S. Crouch20-Aug-11 4:33 
AnswerRe: Java Applet not drawing to screen Pin
Richard MacCutchan20-Aug-11 6:41
mveRichard MacCutchan20-Aug-11 6:41 
GeneralRe: Java Applet not drawing to screen Pin
Liam S. Crouch20-Aug-11 7:44
Liam S. Crouch20-Aug-11 7:44 
GeneralRe: Java Applet not drawing to screen Pin
Richard MacCutchan20-Aug-11 23:28
mveRichard MacCutchan20-Aug-11 23:28 
GeneralRe: Java Applet not drawing to screen Pin
Richard MacCutchan21-Aug-11 8:18
mveRichard MacCutchan21-Aug-11 8:18 
QuestionHow to save the state of applet after changes on webpage? Pin
CodeGust17-Aug-11 15:35
CodeGust17-Aug-11 15:35 
AnswerRe: How to save the state of applet after changes on webpage? Pin
Peter_in_278017-Aug-11 15:49
professionalPeter_in_278017-Aug-11 15:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.