trying to implement concept of LinkedList through java , but it is giving giving error at compile time?

前端 未结 3 1293
故里飘歌
故里飘歌 2021-01-24 21:52

I am trying simple linked list Collection program, but it is not giving me out put.
i created this stuff

import java.lang.*;  
import java.util.*;  

cla         


        
3条回答
  •  北恋
    北恋 (楼主)
    2021-01-24 22:11

    The first answer (by Nandkumar) is right, I'd also check the runtime error, caused by this lines:

    while (litr.hasPrevious ())  
        {  
            Object obj3=litr.next ();  
            System.out.print (obj3+",");  
        }
    

    That is: you check if your iterator has a "previous" item, then go for tne "next"? Probably not what you intended to do.

    The "error" at compile time is only a warning, you can run your program after compilation, but the compiler is telling you that it found something strange in your code.

提交回复
热议问题