Question

Question 5 public class Food { public void Foodmethod_1 (int i) { public void Foodmethod_2 (int i) { } public static void Foo

please this is Java and i need help

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:-

a) Foodmethod_2 in the subclass overriding the Foodmethod_2 in the superclass, because both methods are void methods with single parameter

b) Foodmethod_1 in the subclass hides a method in the super class, because static methods cannot be overriden.They can only be hidden mehtods

c)
//subclass
public class Banku extends Food{
   //constructor 1
   public void Banku(int i, int j){

   }
   //constructor 2
   public void Banku(double d,float f){

   }
}
----------------------------------

Here I Gave Solution For Given Problem

For Any Queries Please Comment

Please Do Like

Add a comment
Know the answer?
Add Answer to:
please this is Java and i need help Question 5 public class Food { public void...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In Java Which of the following statements declares Salaried as a subclass of payType? Public class...

    In Java Which of the following statements declares Salaried as a subclass of payType? Public class Salaried implements PayType Public class Salaried derivedFrom(payType) Public class PayType derives Salaried Public class Salaried extends PayType If a method in a subclass has the same signature as a method in the superclass, the subclass method overrides the superclass method. False True When a subclass overloads a superclass method………. Only the subclass method may be called with a subclass object Only the superclass method...

  • 1) Consider the following Java program: 1 public class HelloWorld { 2     // My first program!...

    1) Consider the following Java program: 1 public class HelloWorld { 2     // My first program! 3     public static void main(String[] args) { 4         System.out.println("Hello, World!"); 5     } 6 } What is on line 1? a. a variable declaration b. a statement c. a method (subroutine) definition d. a comment e. a class definition 2) Which one of the following does NOT describe an array? a. It can be used in a for-each loop. b. It has a numbered sequence...

  • The current code I have is the following: package uml; public class uml {        public...

    The current code I have is the following: package uml; public class uml {        public static void main(String[] args) {              // TODO Auto-generated method stub        } } class Account { private String accountID; public Account(String accountID) { this.accountID = accountID; } public String getAccountID() { return accountID; } public void setAccountID(String accountID) { this.accountID = accountID; } @Override public String toString() { return "Account [accountID=" + accountID + "]"; } } class SuppliesAccount extends Account { private...

  • help me with a question in java: class A { int i = 10; } class...

    help me with a question in java: class A { int i = 10; } class B extends A { int i = 20; } public class Boo { public static void main(String[] args) { A a = new B(); System.out.println(a.i); } }

  • This is an easy Java question Which of the following statements are true? public class Main...

    This is an easy Java question Which of the following statements are true? public class Main public Main(int i, float f) () public Main(float f, int i) public Main(float f) () public void Main0 ) O A. A syntax error will occur because void cannot be used with a constructor. B. A syntax error will occur because the first two constructors are not unique. C. The class does not have a default constructor D. No syntax errors will be generated....

  • In JAVA Algorithm Workbench 1. Write the first line of the definition for a Poodle class....

    In JAVA Algorithm Workbench 1. Write the first line of the definition for a Poodle class. The class should extend the Dog class. 2. Look at the following code, which is the first line of a class definition: public class Tiger extends Felis In what order will the class constructors execute? 3. Write the statement that calls a superclass constructor and passes the arguments x, y, and z. 4. A superclass has the following method: public void setValue(int v) value...

  • Question 5 please java JAVA 3. CODE class MyCustomException extends Exception protected static int numberOfExceptions 0;...

    Question 5 please java JAVA 3. CODE class MyCustomException extends Exception protected static int numberOfExceptions 0; public MyCustomException) super public int getNumberOfExceptions 0 { return numberOfExceptions 4. CODE class MyCustomTooHighException extends MyCustomException { public MyCustomTooHighException() { super.numberOfExceptions ++ class MyCustomTooLowException extends MyCustomException{ public MyCustomTooLowException(){ super.numberOfExceptions ++ We were unable to transcribe this image 3. CODE class MyCustomException extends Exception protected static int numberOfExceptions 0; public MyCustomException) super public int getNumberOfExceptions 0 { return numberOfExceptions 4. CODE class MyCustomTooHighException extends MyCustomException...

  • For Java please.Artwork. javaimport java.util.Scanner;public class ArtworkLabel {public static void main(String[] args)...

     Given main(). define the Artist class (in file Artist java) with constructors to initialize an artist's information, get methods, and a printlnfo() method. The default constructor should initialize the artist's name to "None' and the years of birth and death to 0. printinfo() should display Artist Name, born XXXX if the year of death is -1 or Artist Name (XXXX-YYYY) otherwise. Define the Artwork class (in file Artwork.java) with constructors to initialize an artwork's information, get methods, and a printinfo() method. The constructor should...

  • What is wrong with the following Java Code. public class TestEdible { abstract class Animal {...

    What is wrong with the following Java Code. public class TestEdible { abstract class Animal { /** Return animal sound */ public abstract String sound(); } class Chicken extends Animal implements Edible { @Override public String howToEat() { return "Chicken: Fry it"; } @Override public String sound() { return "Chicken: cock-a-doodle-doo"; } } class Tiger extends Animal { @Override public String sound() { return "Tiger: RROOAARR"; } } abstract class Fruit implements Edible { // Data fields, constructors, and methods...

  • **JAVA*JAVA Question 1 How many k's values will be printed out? public static void main(Stringl args)...

    **JAVA*JAVA Question 1 How many k's values will be printed out? public static void main(Stringl args) for (int k-1: k10:k if (k8) continue: System.out.println k) Question 2 3.5 pts Analyze the following code. Which one is correct? package p public class A package p2: import p1. public class B extends Af int i- 5 private int j- 10: public A0I public static void main(Stringll args) B b new B0: System.out.println(a.i+", "+ajt", "+b.it""+bj): a.i is printable None of them b.i is...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT