1. Which of the following statements contains an error? I. Scanner in = new Scanner(System.in.print); II. System.out.print("Please enter your name (first last): "); III. String firstName = in.next(); I only II only III only I and II only II and III only 2. Which of the following statements contains an error? I. String firstName = in.next(); II. String lastName = in.nextline(); III. System.out.print("\n"); I only II only III only I and II only II and III only
the first one 1 and 2 have errors in them
second one 2 has an error
Here's a link to some info regarding the Scanner class; https://www.udemy.com/blog/java-scanner/
Thank you guys! What about these: Which of the following statements does not contain an error? (2 points) I. String userAge = in.next(); II. String ageInYears = Integer.parseInt(userAge); III. double approxAgeInDays = ageInYears * 365.25; Which of the following statements does not contain an error? (2 points) I. double approxAgeInDays = ageInYears * 365.25; II. ageInHours = (int)approxAgeInDays * 24; III. ageInMinutes = ageInHours * 60; Which of the following statements do not contain an error? (2 points) I. String firstInitial = firstName.subString(0,1); II. String capsLastName = lastName.toUpperCase(); III. String name = firstInitial + ". " + capsLastName;
you're new to java? i would suggest you try the lines of code...
Yes I am... okay!
Join our real-time social learning platform and learn together with your friends!