I need help with the following assignment for intro to Java Match the following
ID: 2247642 • Letter: I
Question
I need help with the following assignment for intro to Java
Match the following terms to the definition below. Note that there are more terms than definitions.
0
1
%f
%d
%n
default package
double
float
instance variables (primitive-type)
int
java.lang package
local variables (primitive-type)
new
nextDouble
nextLine
private
public
void
Which term from the above word bank matches each description below?
The larger primitive data type that can store floating-point numbers
This Scanner method reads characters until a newline character is encountered
Each class declaration that begins with this keyword must be stored in a file that has exactly the same name as the class and ends with the .java filename extension
If a method returns nothing, then its return type is this
This format specifier is used to output floating-point numbers
How many parameters are passed to the default constructor?
This keyword request memory from the system
These variables are initialized to their default values
Class String is in this package
When classes are compiled in the same directory, they are considered to be in the same package, also called this
Answer the following questions:
What is the default constructor?
When is the default constructor not created by Java?
Classes in which packages do you not need to import?
What is the typical return type for a set method?
Describe the three compartments of a UML Class diagram
Explanation / Answer
0 - How many parameters are passed to the default constructor?
1 –
%f - This format specifier is used to output floating-point numbers
%d
%n
default package - When classes are compiled in the same directory, they are considered to be in the same package, also called this
double - The larger primitive data type that can store floating-point numbers
float
instance variables (primitive-type)- These variables are initialized to their default values
int
java.lang package - Class String is in this package
local variables (primitive-type)
new - This keyword request memory from the system
nextDouble
nextLine - This Scanner method reads characters until a newline character is encountered
private –
public - Each class declaration that begins with this keyword must be stored in a file that has exactly the same name as the class and ends with the .java filename extension
void - If a method returns nothing, then its return type is this
Answer the following questions:
What is the default constructor?
Ans)A constructor with no arguments is called default constructor.
When is the default constructor not created by Java?
Ans) when we specified parameterized constructor then the default constructor is not called by java.
Classes in which packages do you not need to import?
Ans) java.lang packages classes we do not need to import .
What is the typical return type for a set method?
Ans) void
Describe the three compartments of a UML Class diagram
Ans) the top compartment contains the name of the class.
The middle component contains the attributes of the class.
The bottom compartment contains the operations the class can execute.
________________Thank You