Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. enter code here{
  2.  
  3.  
  4. import java.util.Scanner;
  5. import java.io.*;
  6. public class test {
  7.  
  8. public static void main(String[] args) {
  9. // TODO Auto-generated method stub
  10. Scanner sc = new Scanner (System.in);
  11. BagBase bb = new BagBase();
  12.  
  13. //System.out.println("Please enter items into the bag: ");
  14. try {
  15. start();
  16. } catch (FileNotFoundException e) {
  17. // TODO Auto-generated catch block
  18. e.printStackTrace();
  19. }
  20. }
  21.  
  22. enter code here
  23. /** This method need to read list from text file and put bag[]
  24.  
  25. public static void start() throws FileNotFoundException {
  26. BagBase bb = new BagBase();//
  27. Scanner sc = new Scanner (System.in);
  28. String wow;
  29. File f = new
  30. File("C:/Users/sruja/workspace/Prjocet1/src/ListForBag.txt");// I this where the location of the file was
  31. Scanner aa = new Scanner (f);
  32. wow=aa.nextLine();// read in
  33. bb.inserItem(wow);// this add into the bag array
  34. System.out.println("your list is done");
  35. bb.prints();// prints the enter array
  36. }
  37. }
  38.  
  39. java.io.FileNotFoundException: C:UserssrujaworkspacePrjocet1srcListForBag.txt (The system cannot find the file specified)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement