I'm working on simple Library Book Log system. I try add book and delete book from system. But I have a proplem in there. When I try to start program. Program is printing next line before scanning book name. How I can fix it?
if(x==1)
        {
            operation.addBook();
        }
 String[] bookshelf = new String[1000];
        //METHODS
        public void addBook()
        {
            Scanner scan = new Scanner (System.in);
            System.out.println("Enter shelf number which you want to add book: " );
            int a = scan.nextInt();
            if (bookshelf[a-1]==null)
            {
                System.out.print("Enter book's name which you want to add: ");
                bookshelf[a-1] = scan.nextLine();
                System.out.println(bookshelf[a-1] + " added to shelf " + a + " successfully");
            }
            else
            {
                System.out.println("This shelf full already");
            }
        }
OUTPUT:
Welcome to LibrarySystem
1-Add book
2-Borrow book
Choose operation number what you want: 1
Enter shelf number which you want to add book: 
1
Enter book's name which you want to add:  added to shelf 1 successfully
 
    