12Consider the following partial class with constructor: public class Filename {
ID: 3679320 • Letter: 1
Question
12Consider the following partial class with constructor:
public class Filename {
private String fullPath;
private char pathSeparator,
extensionSeparator;
public Filename(String str, char sep, char ext) {
fullPath = str;
pathSeparator = sep;
extensionSeparator = ext;
}
Which statement could be used to create an object of the Filename class?
16java.util.Arrays class contains which of the following methods?
17Consider the following class. Which of the following is a good reason for declaring numberOfBicycles with the static keyword?
public class Bicycle {
private int cadence;
private int gear;
private int speed;
private int id;
private static int numberOfBicycles = 0;
...
}
18Consider the following class:
public class Bicycle {
private int cadence;
private int gear;
private int speed;
private int id;
private static int numberOfBicycles = 0;
public Bicycle(int startCadence, int startSpeed, int startGear){
gear = startGear;
cadence = startCadence;
speed = startSpeed;
id = ++numberOfBicycles;
}
public int getVar() {
//TODO return a variable
}
public static int getVariable() {
//TODO return a variable
}
}
Which of the following return statements should be used in the getVar and getVariable methods?
public static int getVariable() {
return numberOfBicycles;
}
public static int getVariable() {
return id;
}
public static int getVariable() {
return numberOfBicycles && id;
}
public static int getVariable() {
return id;
}
19A GUI is a user interface that provides graphical two-way communication between the user and the application.
True
False
20Which of the following are steps in Task Centered GUI Design?
A. Filename myHomePage = new Filename(FPATH, '/', '.'); B. Filename myHomePage = new Filename(); C. Filename myHomePage = new Filename(FPATH); D. All of the aboveExplanation / Answer
Please find the answers below :
12)
A.Filename myHomePage = new Filename(FPATH, '/', '.');
16)
All methods A,B,C,D are present
17)
B)
18)
a) public int getVar() {
return id;
}
public static int getVariable() {
return numberOfBicycles;
}
19)
TRUE
20)
A.Filename myHomePage = new Filename(FPATH, '/', '.');
16)
All methods A,B,C,D are present
17)
B)
You need a variable that can store the total number of bicycles that is unique to a particular instance of this class, but can be accessed and modified by any method of this class.18)
a) public int getVar() {
return id;
}
public static int getVariable() {
return numberOfBicycles;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.