Question
Can a private method be called by any other method in the same class? Group of answer choices True False What is the key word
Can a private method be called by any other method in the same class?
Group of answer choices
True
False
What is the key word to jump out of a method?
Group of answer choices
public
void
return
jump
If there is a statement after a "return" will the statement execute?
Group of answer choices
Yes
No
What does the void do in a method definition?
Group of answer choices
It does nothing, it's just a placeholder
It will prevent the code from compiling
It specifies that the method returns something
It specifies that the method doesn't return anything
Assume you type the following code into the Interactions pane and then actually choose a picture from your computer:
System.out.println(new Picture(FileChooser.pickAFile()));
How do you tell DrJava to show the picture that you selected?
Group of answer choices
show();
FileChooser.show();
Picture.show();
You can't because you haven't given the picture object a name.
The following code uses variable substitution:
Picture pictureObj = new Picture(FileChooser.pickAFile());
pictureObj.show();
and is functionally the same as:
String (Links to an external site.) filename = FileChooser.pickAFile();
Picture pictureObj = new Picture(filename);
pictureObj.show();
However, the second example is different in that it creates a variable name for the filename. What good is this?
Group of answer choices
It runs faster when a String is created.
Nothing, it's just more lines of code.
It runs slower when a String is created.
It allows us to refer to the filename later, if we need it.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started