Click here to Skip to main content
15,893,588 members
Home / Discussions / Java
   

Java

 
AnswerRe: Wav file problems Pin
jschell26-Sep-17 8:18
jschell26-Sep-17 8:18 
QuestionHello India 123 Pin
daves312-Sep-17 4:55
daves312-Sep-17 4:55 
AnswerRe: Hello India 123 Pin
jschell12-Sep-17 6:09
jschell12-Sep-17 6:09 
QuestionSingly Linked List Pin
kinderu12-Sep-17 2:58
kinderu12-Sep-17 2:58 
AnswerRe: Singly Linked List Pin
Richard MacCutchan12-Sep-17 5:07
mveRichard MacCutchan12-Sep-17 5:07 
GeneralRe: Singly Linked List Pin
kinderu12-Sep-17 5:13
kinderu12-Sep-17 5:13 
GeneralRe: Singly Linked List Pin
Richard MacCutchan12-Sep-17 5:37
mveRichard MacCutchan12-Sep-17 5:37 
GeneralRe: Singly Linked List Pin
Richard Deeming12-Sep-17 6:12
mveRichard Deeming12-Sep-17 6:12 
If you can't see the problem, use the debugger to step through your code.
  1. NODE temp = null;
  2. if (isEmpty()) { <-- false, execute "else" block
  3. else {
  4. temp.SetNext(... <-- BOOM! temp is still null here.


You need to decide whether the new node belongs at the start of the list, or at the end of the list.

If it belongs at the start, you set its next node to be the head, and set the head to be the new node.
public void AddNODE(NODE newNode)
{
    newNode.SetNext(head);
    head = newNode;
}

If it belongs at the end, you need to find the last node in the list, and set that node's next node to be the new node. If the list is empty, then set the head to be the new node.
public void AddNODE(NODE newNode)
{
    if (isEmpty()) 
    {
        head = newNode;
    }
    else 
    {
        Node last = head;
        Node temp = last.GetNext();
        
        while (temp != null)
        {
            last = temp;
            temp = last.GetNext();
        }
        
        last.SetNext(newNode);
    }
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


Questionfinger print Pin
Member 1314044319-Aug-17 1:45
Member 1314044319-Aug-17 1:45 
AnswerRe: finger print Pin
jschell21-Aug-17 5:43
jschell21-Aug-17 5:43 
AnswerRe: finger print Pin
Patrice T25-Aug-17 19:26
mvePatrice T25-Aug-17 19:26 
Generaljava Pin
Member 1336471716-Aug-17 19:34
Member 1336471716-Aug-17 19:34 
GeneralRe: java Pin
Richard MacCutchan16-Aug-17 21:17
mveRichard MacCutchan16-Aug-17 21:17 
GeneralRe: java Pin
Patrice T23-Aug-17 16:19
mvePatrice T23-Aug-17 16:19 
QuestionHow to Connect Fingerprint Reader To Java Program Pin
Kistlak12-Aug-17 10:34
Kistlak12-Aug-17 10:34 
AnswerRe: How to Connect Fingerprint Reader To Java Program Pin
Richard MacCutchan12-Aug-17 20:50
mveRichard MacCutchan12-Aug-17 20:50 
SuggestionRe: How to Connect Fingerprint Reader To Java Program Pin
Richard Deeming13-Aug-17 23:42
mveRichard Deeming13-Aug-17 23:42 
GeneralRe: How to Connect Fingerprint Reader To Java Program Pin
Kistlak14-Aug-17 21:28
Kistlak14-Aug-17 21:28 
QuestionReplace placeholders with HTML text in dotx file using docx4 Pin
Sandeep Reddy9-Aug-17 0:08
Sandeep Reddy9-Aug-17 0:08 
AnswerRe: Replace placeholders with HTML text in dotx file using docx4 Pin
jschell14-Aug-17 8:25
jschell14-Aug-17 8:25 
QuestionConvert ms word to PDF on linux Pin
Member 128526088-Aug-17 0:47
Member 128526088-Aug-17 0:47 
AnswerRe: Convert ms word to PDF on linux Pin
Richard MacCutchan8-Aug-17 5:35
mveRichard MacCutchan8-Aug-17 5:35 
GeneralRe: Convert ms word to PDF on linux Pin
Member 128526088-Aug-17 16:00
Member 128526088-Aug-17 16:00 
AnswerRe: Convert ms word to PDF on linux Pin
maba00117-Aug-17 7:07
maba00117-Aug-17 7:07 
Questionjava program using oops concept Pin
coderyadav6-Aug-17 9:21
coderyadav6-Aug-17 9:21 

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.