On exporting INPUT instructions to Java code, the code generator does not take advantage of existent variable declarations or successful type inference, i.e., even if the type of the input variable is known the Java code generator always uses method Scanner.nextLine() to translate the instruction though more appropriate input methods are available for standard types.
Example:
Here, variables priceToPay and customerType have been declared such that type information is available and the methods nextDouble() or nextInt() should have been applied to the Scanner instance (instead of nextLine()).
On exporting INPUT instructions to Java code, the code generator does not take advantage of existent variable declarations or successful type inference, i.e., even if the type of the input variable is known the Java code generator always uses method
Scanner.nextLine()
to translate the instruction though more appropriate input methods are available for standard types. Example:Here, variables
priceToPay
andcustomerType
have been declared such that type information is available and the methodsnextDouble()
ornextInt()
should have been applied to the Scanner instance (instead ofnextLine()
).