1.Consider the following Java program, which one of the following best describes "Food()"?public class Food {
static int count;
private String flavor = "sweet";
Food() { count++; }
void setFlavor(String s) { flavor = s; }
String getFlavor() { return flavor; }
static public void main(String[] args) {
Food pepper = new Food();
System.out.println(pepper.getFlavor());
}
}
Select one:
a. a class variable
b. a constructor
c. a local object variable
d. an instance variable
e. a method
2. Consider the following Java program, which one of the following best describes "count"?
public class Food {
static int count;
private String flavor = "sweet";
Food() { count++; }
void setFlavor(String s) { flavor = s; }
String getFlavor() { return flavor; }
static public void main(String[] args) {
Food pepper = new Food();
System.out.println(pepper.getFlavor());
}
}
Select one:
a. a class variable
b. a constructor
c. a local object variable
d. an instance variable
e. a method
3.Which one of the following Java technologies eliminates memory leaks?
Select one:
a. garbage collection
b. just-in-time compilers
c. object-oriented analysis and design
d. software engineering
e. virtual machines
4.Consider the following Java program, which one of the following best describes "pepper"?
public class Food {
static int count;
private String flavor = "sweet";
Food() { count++; }
void setFlavor(String s) { flavor = s; }
String getFlavor() { return flavor; }
static public void main(String[] args) {
Food pepper = new Food();
System.out.println(pepper.getFlavor());
}
}
Select one:
a. an object
b. a reference
c. null
d. sweet
e. The program does not compile.
5.What is the output of the following Java program?
public class Food {
static int count;
private String flavor = "sweet";
Food(String s) { flavor = s; }
void setFlavor(String s) { flavor = s; }
String getFlavor() { return flavor; }
static public void main(String[] args) {
Food pepper = new Food();
System.out.println(pepper.getFlavor());
}
}
Select one:
a. 1
b. 2
c. spicy
d. sweet
e. The program does not compile.
Unlock full access to Course Hero
Explore over 16 million step-by-step answers from our library
Subscribe to view answeritae odio. Donec aliquet. Lorem ip
ctum vitae odio. Donec aliquet. Lorem ipsum dolo
s a molestie consequat, ultrices ac magn
usce dui lectus, congue vel laoreet ac, dictum vitae od
sum dolor
o
ce dui lectus, c
, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec ali
e vel laoreet ac, d
gue vel laoreet ac, dictu
nec facilisis. Pellentesque dapibus ef
entesque dapibus efficitur
trices ac magna. Fusce dui lectus, congue vel la
, dictum vitae odio. Donec aliquet. Lorem ip
ctum vitae odio. Donec aliquet. Lorem ipsum dolo
s a molestie consequat, ultrices ac magn
usce dui lectus, congue vel laoreet ac, dictum vitae od
sum dolor
o
itur laoreet. Nam r
, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consect
e vel laoreet ac, dic
, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dap
e vel laoreet ac, d
gue vel laoreet ac, dictu
nec facilisis. Pellentesque dapibus ef
entesque dapibus efficitur
trices ac magna. Fusce dui lectus, congue vel la
, dictum vitae odio. Donec aliquet. Lorem ip
ctum vitae odio. Donec aliquet. Lorem ipsum dolo
s a molestie consequat, ultrices ac magn
usce dui lectus, congue vel laoreet ac, dictum vitae od
sum dolor
o
, dictum vi
gue vel laoreet ac, dictum vitae odio. Donec aliqu
e vel laoreet ac, d
gue vel laoreet ac, dictu
nec facilisis. Pellentesque dapibus ef
icitur laoreet. Nam risus ante, dapibu
trices ac magna. Fusce dui lectus, congue vel la
, dictum vitae odio. Donec aliquet. Lorem ip
ctum vitae odio. Donec aliquet. Lorem ipsum dolo
s a molestie consequat, ultrices ac magn
usce dui lectus, congue vel laoreet ac, dictum vitae od
sum dolor
o
, ultric