Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

TRUE OR FALSE 1. A Scanner class can be used to read in user input. 2. Example syntax for creating a Scanner to read user

TRUE OR FALSE

1. A Scanner class can be used to read in user input.

2. Example syntax for creating a Scanner to read user input is:

Scanner input = new Scanner("System.in");

3. The println() statement can be used to provide a prompt to the user.

4. When using printf(), you can use %d as the format specifier for an int type.

5. An import statement, such as the one to import java.util.Scanner should be the very last line in an application.

6. You should always declare your instance variables as type public.

7. Getters are used to set the value of private instance variables.

8. Your application can use a getter to get the current value of an instance variable of an object that your application has created.

9. You must always have an else part for every if statement.

10. The following code will result in the code repeated while i is less than 5, causing the value of i to be printed out as 5.

int i = 0; while (i<5); { i++; } System.out.printf("%d", i);

11. for loops can never result in an infinite loop.

12. Pseudocode is helpful for algorithm development.

13. Example syntax for a 3 argument constructor for a Book class that takes an int value, a double, and a String:

public Book (int num1, double num2, String name) { bookId = num1; bookPrice = num2; title = name; }

14. Example call to the Book constructor from an application could be:

Book myBook = new Book("5", "3.5", "The Rabbit Ran");

15. A no argument default constructor will not be provided automatically by the Java compiler once you have declared your own constructor for a class.

16. Constructors should always have a return type of void.

17. The eight primitive Java types are: boolean, String, int, char, double, float, long, byte.

18. A UML class diagram can be used to design your class.

19. Relational operators can be used to create the condition for an if statement but never a while loop.

20. In Java, && represents a Conditional AND operator.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Oracle Fusion Applications Installation And Administration

Authors: Tushar Thakker

1st Edition

1484209834, 9781484209837

More Books

Students also viewed these Databases questions

Question

17. As new data becomes available, repeat steps 11 through 16.

Answered: 1 week ago

Question

16. Implement this MPEMP.

Answered: 1 week ago