gmoney1973
26.10.2020 •
Computers and Technology
What is the issue with this code
interface Box2{
static final int ITEM_CODE=201;
int method1();
double method2();
}
public class Window implements Box2{
public int method1(){
return ITEM_CODE;
}
}
public class myFrame{
public static void main(String args[]){
Window w = new Window();
System.out.println(w.method1());
}
}
A.
The interface should be declared as abstract.
B.
The class should be declared as abstract.
C.
The interface should have an implementation of method2.
D.
The class should have an implementation of method2.
Solved
Show answers
More tips
- S Style and Beauty How to Braid Hair with a Plaiting Machine: Tips and Recommendations...
- B Business and Finance How to Create a Business Plan? Your Ultimate Guide...
- F Food and Cooking Deflope: What is it and how does it work?...
- F Food and Cooking Why Doesn t the Confirmation Link Come to Email?...
- F Food and Cooking How to Get Reconfirmation of Registration?...
- S Science and Technology Discovering the Anatomy of an LCD TV Screen...
- H Health and Medicine What You Need to Know About Nasal Congestion in Infants: Causes, Symptoms, and Treatment...
- A Auto and Moto What is the Average Lifespan of an Engine in a Car?...
- C Computers and Internet Make Money Online: Secrets and Essential Ways...
- A Auto and Moto How Can Parking Sensors Help Drivers?...
Answers on questions: Computers and Technology
- C Computers and Technology Liquid-liquid extraction is best suited to separate a mixture of compounds when: A. The mixture contains compounds with similar polarities but different solubilities. B. The...
- C Computers and Technology Need help with Linux homework! Please take screenshots if you can. With console logging enabled, write a program that consists of two C++ source files. The first file contains...
- C Computers and Technology Natalia is using the software development life cycle to create a program that will calculate a user s fitness level. She has defined her project goals, created a requirements...
- M Mathematics Somenone im faling horribly there is two qestion i need on any one know both...
- E English Which three elements belong to the sift method?...
- B Biology What is shown on the graph a) exponential decay of a population...
- H History What used to be the name of the republican party?...
- M Mathematics Fourteen minivans, each holding the same number of students and one driver, set out for the spring track competition. on the way, 2 minivans broke down and were towed away...
- H History What are newspapers and magazines? a. broadsheets b. muckrakers c. broadcast media d. print media...
- M Mathematics In what direction is the net force and what is its value ?...
Ответ:
Question: What is the issue with this code
interface Box2{
static final int ITEM_CODE=201;
int method1();
double method2();
public class Window implements Box2{
public int method1(){
return ITEM_CODE;
public class myFrame{
public static void main(String args[]){
Window w = new Window();
System.out.println(w.method1());
A. The interface should be declared as abstract.
B. The class should be declared as abstract.
C. The interface should have an implementation of method2.
D. The class should have an implementation of method2.
A The interface should be declared as abstract.
Ответ:
Answer is in the provided screenshot!
Explanation:
Steps required to solve this problem:
1 - define what characters are "vowels" by assigning them to an array.
2 - create a variable to record the amount of vowels there are in the string.
3 - convert the input string into a character array and iterate through each character
4 - for each of the character of the string we go through, check if it matches any of the vowels
5 - return true if the vowel count is greater than 1
Alternative methods using the Java Stream API have also been wrote, please respond if you require them.