Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何解决;错误:找不到符号";在爪哇? public void sort(){ 节点分类列表=空; while(sortedList!=null){ 节点电流=分类列表; sortedList=sortedList.next; 节点x; Node-previous=null; for(x=sortedList;x!=null;x=x.next){ 如果(当前值_Java - Fatal编程技术网

Java 如何解决;错误:找不到符号";在爪哇? public void sort(){ 节点分类列表=空; while(sortedList!=null){ 节点电流=分类列表; sortedList=sortedList.next; 节点x; Node-previous=null; for(x=sortedList;x!=null;x=x.next){ 如果(当前值

Java 如何解决;错误:找不到符号";在爪哇? public void sort(){ 节点分类列表=空; while(sortedList!=null){ 节点电流=分类列表; sortedList=sortedList.next; 节点x; Node-previous=null; for(x=sortedList;x!=null;x=x.next){ 如果(当前值,java,Java,这是错误消息: public void sort(){ Node sortedList = null; while(sortedList != null){ Node current = sortedList; sortedList = sortedList.next; Node x; Node previous = null; for(x = sortedList; x != null; x = x.next){ if(cu

这是错误消息:

public void sort(){

 Node sortedList = null;

   while(sortedList != null){

    Node current = sortedList;
    sortedList = sortedList.next;
    Node x;
    Node previous = null;
    for(x = sortedList; x != null; x = x.next){
        if(current.value < x.value){
                break;
         }
         previous = x;
    }
    if(previous == null){               
          current.next = sortedList;
          sortedList = current;
    }
    else{               
       current.next = previous.next;
       previous.next = current;
    }

  return sortedList;
}}}
LinkedList.java:352:错误:找不到符号
如果(当前值
这是因为方法
sort()
的返回类型是
void
,但您正试图从
sort()返回值

查看您的代码,我想您可能希望将其声明为:

return sortedList;

附加说明:您发布的代码段似乎有附加的右大括号}。您可能还需要查找它。

这是错误消息LinkedList。java:352:error:not find symbol if(current.value节点的定义
return sortedList;
public Node sort()