JAVA TRUE OR FALSE TEST

JAVA: TRUE OR FALSE TEST -

The second part of the Key assignment is a competency test that will test your knowledge on fundamental data types, control structures, classes, objects, and methods. If you do not pass this competency exam you will not be able to proceed to the second Java course in this series.

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);

“for” loops can never result in an infinite loop.
Pseudocode is helpful for algorithm development.
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;
}

1. Example call to the Book constructor from an application could be:
Book myBook = new Book("5", "3.5", "The Rabbit Ran");

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

1. Constructors should always have a return type of ‘void’.

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

1. A UML class diagram can be used to design your class.
1. Relational operators can be used to create the condition for an “if” statement but never a “while” loop.

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

    • Posted: 6 years ago
    Solution

    Purchase the answer to view it

    blurred-text
    Save time and money!
    Our teachers already did such homework, use it as a reference!
    • JAVA: TRUE OR FALSE TEST -

      The second part of the Key assignment is a competency test that will test your knowledge on fundamental data types, control structures, classes, objects, …