I call a method in my main app to give some String
variables to the constructor of a class but here is a problem: When I call the method (while running the program), my first input line is being ignored. Here is my code :
Here i call the method in main.
Rent r1=new Rent();
RentProcess(r1);
This is the method with the problem.
public static void RentProcess(Rent r) {
System.out.println("Name and telephone : \n");
r.setNameAndTel(in.nextLine());
System.out.println("Rental date : \n");
r.setRentDate(in.nextLine());
}
Here is the ingoring line when i run the app.
Choose between :
1 --> Rent
2 --> Exit
1
Name and telephone :
Rental date :
20/2
And when i print the info above.
Rent Code : 0
Name and Telephone
Date of Rent : 20/2
Days of Rent : 0
Rent cost is : 0.0
Name : The Wolf Of Wall Street