Advertisement
darkstar97

lista java - main

Apr 16th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1.  
  2. public class main { //lista
  3.     public static void main(String[] args){
  4.         Lista lis = new Lista();
  5.        
  6.         Node n1 = new Node();
  7.         Node n2 = new Node();
  8.         Node n3 = new Node();
  9.        
  10.         n1.setValor(5);
  11.         n2.setValor(15);
  12.         n3.setValor(55);
  13.        
  14.         lis.insereInicio(n1);
  15.         lis.insereFim(n2);
  16.         lis.insereInicio(n3);
  17.        
  18.         if(lis.busca(5))
  19.             System.out.println("O valor foi achado.\n");
  20.        
  21.         else
  22.             System.out.println("Valor não encontrado.\n");
  23.        
  24.         System.out.println("Lista:");
  25.         lis.toString();
  26.        
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement